From 1a63c47cf9fa3e6eb47c3ca278899802cf45a014 Mon Sep 17 00:00:00 2001 From: Ian Martin Date: Tue, 15 Apr 2014 17:36:55 -0400 Subject: [PATCH] CC2538: Add CONF parameters to select boot loader backdoor pin and logic level. --- cpu/cc2538/dev/flash-cca.h | 1 + platform/cc2538dk/contiki-conf.h | 9 +++++++++ platform/cc2538dk/startup-gcc.c | 16 +++++++++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/cpu/cc2538/dev/flash-cca.h b/cpu/cc2538/dev/flash-cca.h index 2dff2978b..a81bab702 100644 --- a/cpu/cc2538/dev/flash-cca.h +++ b/cpu/cc2538/dev/flash-cca.h @@ -58,6 +58,7 @@ #define FLASH_CCA_BOOTLDR_CFG_ACTIVE_HIGH 0x08000000 /**< Selected pin on pad A active high */ #define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_M 0x07000000 /**< Selected pin on pad A mask */ #define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S 24 /**< Selected pin on pad A shift */ +#define FLASH_CCA_BOOTLDR_CFG_PORT_A_LEVEL_S 27 /**< Pin level shift */ /** @} */ /*---------------------------------------------------------------------------*/ /** \name Image valid definitions diff --git a/platform/cc2538dk/contiki-conf.h b/platform/cc2538dk/contiki-conf.h index 964d01074..2188fa353 100644 --- a/platform/cc2538dk/contiki-conf.h +++ b/platform/cc2538dk/contiki-conf.h @@ -48,7 +48,16 @@ typedef uint32_t rtimer_clock_t; #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /** 1) ) + #error Invalid boot loader backdoor pin level. Please set FLASH_CCA_CONF_BOOTLDR_BACKDOOR_LEVEL to 0 (logic low) or 1 (logic high). + #endif + + #if ( (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN < 0) || (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN > 7) ) + #error Invalid boot loader backdoor pin. Please set FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN between 0 and 7 (indicating PA0 - PA7). + #endif + + #define FLASH_CCA_BOOTLDR_CFG ( FLASH_CCA_BOOTLDR_CFG_ENABLE \ + | (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_LEVEL << FLASH_CCA_BOOTLDR_CFG_PORT_A_LEVEL_S) \ + | (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN << FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S) ) #else #define FLASH_CCA_BOOTLDR_CFG FLASH_CCA_BOOTLDR_CFG_DISABLE #endif