From 06bbb65bdb6eddca3bbed20c28836b1137658ad3 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Thu, 16 Aug 2018 22:01:48 +0100 Subject: [PATCH] Simplify configuration of the CC13xx/CC26xx ROM bootloader Currently board.h does all the work, but it does not really need to. This commit moves most of the ccfg defines to ccxxware-conf.h and now board.h only needs to specify the bootloader enable pin and corresponding level. --- arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h | 10 +++++++-- arch/cpu/cc26xx-cc13xx/ccxxware-conf.h | 20 ++++++++++++++++++ .../srf06-cc26xx/launchpad/cc1310/board.h | 21 ++++++------------- .../srf06-cc26xx/launchpad/cc1350/board.h | 21 ++++++------------- .../srf06-cc26xx/launchpad/cc2640r2/board.h | 21 ++++++------------- .../srf06-cc26xx/launchpad/cc2650/board.h | 21 ++++++------------- .../srf06-cc26xx/sensortag/cc1350/board.h | 10 +++++++++ .../srf06-cc26xx/sensortag/cc2650/board.h | 10 +++++++++ .../srf06-cc26xx/srf06/cc13xx/board.h | 21 ++++++------------- .../srf06-cc26xx/srf06/cc26xx/board.h | 21 ++++++------------- .../cc26xx/cc26xx-web-demo/project-conf.h | 2 +- .../platform-specific/cc26xx/project-conf.h | 2 +- .../cc26xx/very-sleepy-demo/project-conf.h | 3 +-- examples/sensniff/srf06-cc26xx/target-conf.h | 6 +++--- 14 files changed, 90 insertions(+), 99 deletions(-) diff --git a/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h b/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h index 6ff047ebe..e7d9dacd7 100644 --- a/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h +++ b/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h @@ -199,8 +199,14 @@ * the chip to enter bootloader mode. * @{ */ -#ifndef ROM_BOOTLOADER_ENABLE -#define ROM_BOOTLOADER_ENABLE 1 + +/* Backward compatibility */ +#ifdef ROM_BOOTLOADER_ENABLE +#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE ROM_BOOTLOADER_ENABLE +#endif + +#ifndef CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE +#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 #endif /** @} */ /*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc26xx-cc13xx/ccxxware-conf.h b/arch/cpu/cc26xx-cc13xx/ccxxware-conf.h index 97be16b5d..bc26f1171 100644 --- a/arch/cpu/cc26xx-cc13xx/ccxxware-conf.h +++ b/arch/cpu/cc26xx-cc13xx/ccxxware-conf.h @@ -68,6 +68,26 @@ #define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0x00 #endif /** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief ROM bootloader configuration + * + * Those values are not meant to be modified by the user + * @{ + */ +#if CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE +#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 +#define SET_CCFG_BL_CONFIG_BL_LEVEL CCXXWARE_CONF_BL_LEVEL +#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCXXWARE_CONF_BL_PIN_NUMBER +#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 +#else +#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 +#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 +#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER IOID_UNUSED +#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ #endif /* CCXXWARE_CONF_H_ */ /*---------------------------------------------------------------------------*/ /** diff --git a/arch/platform/srf06-cc26xx/launchpad/cc1310/board.h b/arch/platform/srf06-cc26xx/launchpad/cc1310/board.h index 41e929571..71253b063 100644 --- a/arch/platform/srf06-cc26xx/launchpad/cc1310/board.h +++ b/arch/platform/srf06-cc26xx/launchpad/cc1310/board.h @@ -141,23 +141,14 @@ /** * \brief ROM bootloader configuration * - * Change SET_CCFG_BL_CONFIG_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select - * which button triggers the bootloader on reset. - * - * The remaining values are not meant to be modified by the user + * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which + * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to + * control the pin level that enables the bootloader (0: low, 1: high). It is + * also possible to use any other externally-controlled DIO. * @{ */ -#if ROM_BOOTLOADER_ENABLE -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 -#else -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0xFF -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF -#endif +#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT +#define CCXXWARE_CONF_BL_LEVEL 0 /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/arch/platform/srf06-cc26xx/launchpad/cc1350/board.h b/arch/platform/srf06-cc26xx/launchpad/cc1350/board.h index 643d69e0b..bef7ef78e 100644 --- a/arch/platform/srf06-cc26xx/launchpad/cc1350/board.h +++ b/arch/platform/srf06-cc26xx/launchpad/cc1350/board.h @@ -158,23 +158,14 @@ /** * \brief ROM bootloader configuration * - * Change SET_CCFG_BL_CONFIG_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select - * which button triggers the bootloader on reset. - * - * The remaining values are not meant to be modified by the user + * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which + * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to + * control the pin level that enables the bootloader (0: low, 1: high). It is + * also possible to use any other externally-controlled DIO. * @{ */ -#if ROM_BOOTLOADER_ENABLE -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 -#else -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0xFF -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF -#endif +#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT +#define CCXXWARE_CONF_BL_LEVEL 0 /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/arch/platform/srf06-cc26xx/launchpad/cc2640r2/board.h b/arch/platform/srf06-cc26xx/launchpad/cc2640r2/board.h index 66ba6d78c..6d0edbe7c 100644 --- a/arch/platform/srf06-cc26xx/launchpad/cc2640r2/board.h +++ b/arch/platform/srf06-cc26xx/launchpad/cc2640r2/board.h @@ -141,23 +141,14 @@ /** * \brief ROM bootloader configuration * - * Change SET_CCFG_BL_CONFIG_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select - * which button triggers the bootloader on reset. - * - * The remaining values are not meant to be modified by the user + * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which + * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to + * control the pin level that enables the bootloader (0: low, 1: high). It is + * also possible to use any other externally-controlled DIO. * @{ */ -#if ROM_BOOTLOADER_ENABLE -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 -#else -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0xFF -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF -#endif +#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT +#define CCXXWARE_CONF_BL_LEVEL 0 /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/arch/platform/srf06-cc26xx/launchpad/cc2650/board.h b/arch/platform/srf06-cc26xx/launchpad/cc2650/board.h index 822e776b8..cee29a06e 100644 --- a/arch/platform/srf06-cc26xx/launchpad/cc2650/board.h +++ b/arch/platform/srf06-cc26xx/launchpad/cc2650/board.h @@ -141,23 +141,14 @@ /** * \brief ROM bootloader configuration * - * Change SET_CCFG_BL_CONFIG_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select - * which button triggers the bootloader on reset. - * - * The remaining values are not meant to be modified by the user + * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which + * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to + * control the pin level that enables the bootloader (0: low, 1: high). It is + * also possible to use any other externally-controlled DIO. * @{ */ -#if ROM_BOOTLOADER_ENABLE -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 -#else -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0xFF -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF -#endif +#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT +#define CCXXWARE_CONF_BL_LEVEL 0 /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/arch/platform/srf06-cc26xx/sensortag/cc1350/board.h b/arch/platform/srf06-cc26xx/sensortag/cc1350/board.h index 6fdab1295..fca3246ce 100644 --- a/arch/platform/srf06-cc26xx/sensortag/cc1350/board.h +++ b/arch/platform/srf06-cc26xx/sensortag/cc1350/board.h @@ -253,6 +253,16 @@ #define BOARD_BUTTON_HAL_INDEX_REED_RELAY 0xFF /** @} */ /*---------------------------------------------------------------------------*/ +/** + * \brief ROM bootloader configuration + * + * Sensortags do not support the bootloader + * @{ + */ +#define CCXXWARE_CONF_BL_PIN_NUMBER IOID_UNUSED +#define CCXXWARE_CONF_BL_LEVEL 0 +/** @} */ +/*---------------------------------------------------------------------------*/ /** * \name Device string used on startup * @{ diff --git a/arch/platform/srf06-cc26xx/sensortag/cc2650/board.h b/arch/platform/srf06-cc26xx/sensortag/cc2650/board.h index dda3e46e5..706665757 100644 --- a/arch/platform/srf06-cc26xx/sensortag/cc2650/board.h +++ b/arch/platform/srf06-cc26xx/sensortag/cc2650/board.h @@ -234,6 +234,16 @@ #define BOARD_BUTTON_HAL_INDEX_REED_RELAY 0xFF /** @} */ /*---------------------------------------------------------------------------*/ +/** + * \brief ROM bootloader configuration + * + * Sensortags do not support the bootloader + * @{ + */ +#define CCXXWARE_CONF_BL_PIN_NUMBER IOID_UNUSED +#define CCXXWARE_CONF_BL_LEVEL 0 +/** @} */ +/*---------------------------------------------------------------------------*/ /** * \name Device string used on startup * @{ diff --git a/arch/platform/srf06-cc26xx/srf06/cc13xx/board.h b/arch/platform/srf06-cc26xx/srf06/cc13xx/board.h index 9fece9180..4c0fcf686 100644 --- a/arch/platform/srf06-cc26xx/srf06/cc13xx/board.h +++ b/arch/platform/srf06-cc26xx/srf06/cc13xx/board.h @@ -213,23 +213,14 @@ /** * \brief ROM bootloader configuration * - * Change SET_CCFG_BL_CONFIG_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select - * which button triggers the bootloader on reset. - * - * The remaining values are not meant to be modified by the user + * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which + * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to + * control the pin level that enables the bootloader (0: low, 1: high). It is + * also possible to use any other externally-controlled DIO. * @{ */ -#if ROM_BOOTLOADER_ENABLE -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER BOARD_IOID_KEY_SELECT -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 -#else -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0xFF -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF -#endif +#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_SELECT +#define CCXXWARE_CONF_BL_LEVEL 0 /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/arch/platform/srf06-cc26xx/srf06/cc26xx/board.h b/arch/platform/srf06-cc26xx/srf06/cc26xx/board.h index b9171388a..f31a94fb3 100644 --- a/arch/platform/srf06-cc26xx/srf06/cc26xx/board.h +++ b/arch/platform/srf06-cc26xx/srf06/cc26xx/board.h @@ -213,23 +213,14 @@ /** * \brief ROM bootloader configuration * - * Change SET_CCFG_BL_CONFIG_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select - * which button triggers the bootloader on reset. - * - * The remaining values are not meant to be modified by the user + * Change CCXXWARE_CONF_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select which + * button triggers the bootloader on reset. Use CCXXWARE_CONF_BL_LEVEL to + * control the pin level that enables the bootloader (0: low, 1: high). It is + * also possible to use any other externally-controlled DIO. * @{ */ -#if ROM_BOOTLOADER_ENABLE -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER BOARD_IOID_KEY_SELECT -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 -#else -#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 -#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 -#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0xFF -#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF -#endif +#define CCXXWARE_CONF_BL_PIN_NUMBER BOARD_IOID_KEY_SELECT +#define CCXXWARE_CONF_BL_LEVEL 0 /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/examples/platform-specific/cc26xx/cc26xx-web-demo/project-conf.h b/examples/platform-specific/cc26xx/cc26xx-web-demo/project-conf.h index 36114eeb7..ee40e1749 100644 --- a/examples/platform-specific/cc26xx/cc26xx-web-demo/project-conf.h +++ b/examples/platform-specific/cc26xx/cc26xx-web-demo/project-conf.h @@ -64,7 +64,7 @@ #define SENSORTAG_CC2650_REV_1_2_0 0 /*---------------------------------------------------------------------------*/ /* Enable the ROM bootloader */ -#define ROM_BOOTLOADER_ENABLE 1 +#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 /*---------------------------------------------------------------------------*/ /* * Shrink the size of the uIP buffer, routing table and ND cache. diff --git a/examples/platform-specific/cc26xx/project-conf.h b/examples/platform-specific/cc26xx/project-conf.h index 17bd2ce29..3cbc0da86 100644 --- a/examples/platform-specific/cc26xx/project-conf.h +++ b/examples/platform-specific/cc26xx/project-conf.h @@ -32,7 +32,7 @@ #define PROJECT_CONF_H_ /*---------------------------------------------------------------------------*/ /* Enable the ROM bootloader */ -#define ROM_BOOTLOADER_ENABLE 1 +#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 /*---------------------------------------------------------------------------*/ /* Change to match your configuration */ #define IEEE802154_CONF_PANID 0xABCD diff --git a/examples/platform-specific/cc26xx/very-sleepy-demo/project-conf.h b/examples/platform-specific/cc26xx/very-sleepy-demo/project-conf.h index f22fb2685..0f8467a68 100644 --- a/examples/platform-specific/cc26xx/very-sleepy-demo/project-conf.h +++ b/examples/platform-specific/cc26xx/very-sleepy-demo/project-conf.h @@ -35,9 +35,8 @@ #define IEEE802154_CONF_PANID 0xABCD #define IEEE802154_CONF_DEFAULT_CHANNEL 25 /*---------------------------------------------------------------------------*/ - /* Enable the ROM bootloader */ -#define ROM_BOOTLOADER_ENABLE 1 +#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 /*---------------------------------------------------------------------------*/ /* For very sleepy operation */ #define RF_BLE_CONF_ENABLED 0 diff --git a/examples/sensniff/srf06-cc26xx/target-conf.h b/examples/sensniff/srf06-cc26xx/target-conf.h index 4d9deffda..b86df35c5 100644 --- a/examples/sensniff/srf06-cc26xx/target-conf.h +++ b/examples/sensniff/srf06-cc26xx/target-conf.h @@ -32,9 +32,9 @@ #ifndef TARGET_CONF_H_ #define TARGET_CONF_H_ /*---------------------------------------------------------------------------*/ -#define CC26XX_UART_CONF_BAUD_RATE 460800 -#define RF_BLE_CONF_ENABLED 0 -#define ROM_BOOTLOADER_ENABLE 1 +#define CC26XX_UART_CONF_BAUD_RATE 460800 +#define RF_BLE_CONF_ENABLED 0 +#define CCXXWARE_CONF_ROM_BOOTLOADER_ENABLE 1 /*---------------------------------------------------------------------------*/ #define SENSNIFF_IO_DRIVER_H "pool/cc13xx-cc26xx-io.h" /*---------------------------------------------------------------------------*/