Make ROM bootloader configurable through contiki- or project-conf.h

This commit is contained in:
George Oikonomou 2016-06-11 19:44:27 +01:00
parent 01590088d3
commit 4495d14702
7 changed files with 124 additions and 7 deletions

View file

@ -101,6 +101,12 @@ $(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE | $(OBJECTDIR)
$(TRACE_CC)
$(Q)$(CC) $(CFLAGS) -c $< -o $@
### Always re-build ccfg.c so changes to ccfg-conf.h will apply without having
### to make clean first
$(OBJECTDIR)/ccfg.o: ccfg.c FORCE | $(OBJECTDIR)
$(TRACE_CC)
$(Q)$(CC) $(CFLAGS) -include "contiki-conf.h" -c $< -o $@
### Compilation rules
CUSTOM_RULE_LINK=1

View file

@ -107,23 +107,31 @@ If the `BOARD` variable is unspecified, an image for the Srf06 CC26XXEM will be
If you want to switch between building for one platform to the other, make certain to `make clean` before building for the new one, or you will get linker
errors.
If you want to upload the compiled firmware to a node via the serial boot loader you need to manually enable the boot loader and then use `make cc26xx-demo.upload`. On the SmartRF06 board you enable the boot loader by resetting the board (EM RESET button) while holding the `select` button. (The boot loader backdoor needs to be enabled on the chip, and the chip needs to be configured correctly, for this to work. See README in the `tools/cc2538-bsl` directory for more info). The serial uploader script will automatically pick the first available serial port. If this is not the port where your node is connected, you can force the script to use a specific port by defining the `PORT` argument eg. `make cc26xx-demo.upload PORT=/dev/tty.usbserial`
The serial bootloader can also be used with the LaunchPad and the changes required to achieve this are the same as those required for the SmartRF. The only difference is that you will need to map `BL_PIN_NUMBER` to either the left or right user button (values to be used for `BL_PIN_NUMBER` in `ccfg.c` are `0x0D` and `0x0E` respectively).
Note that uploading over serial doesn't work for the Sensortag, you can use TI's SmartRF Flash Programmer in this case.
For the `cc26xx-demo`, the included readme describes in detail what the example does.
To generate an assembly listing of the compiled firmware, run `make cc26xx-demo.lst`. This may be useful for debugging or optimizing your application code. To intersperse the C source code within the assembly listing, you must instruct the compiler to include debugging information by adding `CFLAGS += -g` to the project Makefile and rebuild by running `make clean cc26xx-demo.lst`.
How to Program your Device
--------------------------
To program your device on Windows, use TI's [SmartRF Flash Programmer][smart-rf-flashprog] (FLASH-PROGRAMMER-2).
On Linux and OS X, you can program your device via the chip's serial ROM boot loader. In order for this to work, the following conditions need to be met:
* The board can support the bootloader. This is the case for SmartRF06EB with CC26xx/CC13xx EMs and it is also the case for LaunchPads. Note that uploading over serial does not (and will not) work for the Sensortag.
* The chip is not programmed with a valid image, or the image has the bootloader backdoor unlocked. To enable the bootloader backdoor in your image, define `ROM_BOOTLOADER_ENABLE` to 1 in `contiki-conf.h`.
You will then need to manually enter the boot loader and use the `.upload` make target (e.g. `make cc26xx-demo.upload` for the `cc26xx-demo`). On the SmartRF06, you enter the boot loader by resetting the EM (EM RESET button) while holding the `select` button. For the LaunchPad, you enter the bootloader by resetting the chip while holding `BTN_1`. It is possible to change the pin and its corresponding level (High/Low) that will trigger bootloader mode by changing `SET_CCFG_BL_CONFIG_BL_LEVEL` and `SET_CCFG_BL_CONFIG_BL_PIN_NUMBER` in `board.h`.
The serial uploader script will automatically pick the first available serial port. If this is not the port where your node is connected, you can force the script to use a specific port by defining the `PORT` argument eg. `make cc26xx-demo.upload PORT=/dev/tty.usbserial`.
For more information on the serial bootloader, see its README under the `tools/cc2538-bsl` directory.
CC13xx/CC26xx Border Router over UART
=====================================
The platform code can be used as a border router (SLIP over UART) by using the
example under `examples/ipv6/rpl-border-router`. This example defines the
following:
#ifndef UIP_CONF_BUFFER_SIZE
#define UIP_CONF_BUFFER_SIZE 140
#endif
@ -234,3 +242,5 @@ The chip will come out of low power mode by one of the following events:
is an AON RTC Channel 2 compare interrupt.
* Rtimer triggers, as part of ContikiMAC's sleep/wake-up cycles. The rtimer
sits on the AON RTC channel 0.
[smart-rf-flashprog]: http://www.ti.com/tool/flash-programmer "SmartRF Flash Programmer"

View file

@ -288,6 +288,19 @@
#endif
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name ROM Bootloader configuration
*
* Enable/Disable the ROM bootloader in your image, if the board supports it.
* Look in board.h to choose the DIO and corresponding level that will cause
* the chip to enter bootloader mode.
* @{
*/
#ifndef ROM_BOOTLOADER_ENABLE
#define ROM_BOOTLOADER_ENABLE 0
#endif
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name Button configurations
*

View file

@ -150,6 +150,28 @@
#define BOARD_IOID_SDA IOID_5
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \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
* @{
*/
#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
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \brief Remaining pins
*

View file

@ -150,6 +150,28 @@
#define BOARD_IOID_SDA IOID_5
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \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
* @{
*/
#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
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \brief Remaining pins
*

View file

@ -227,6 +227,28 @@
#define BOARD_ACC_MISO BOARD_SPI_MISO
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \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
* @{
*/
#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
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name Device string used on startup
* @{

View file

@ -227,6 +227,28 @@
#define BOARD_ACC_MISO BOARD_SPI_MISO
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \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
* @{
*/
#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
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name Device string used on startup
* @{