Merge pull request #551 from JelmerT/feature-cc2538-bsl

CC2538 serial boot loader python script
This commit is contained in:
George Oikonomou 2014-03-09 02:11:36 +00:00
commit 6dc9dfa6c2
6 changed files with 49 additions and 6 deletions

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "tools/mspsim"] [submodule "tools/mspsim"]
path = tools/mspsim path = tools/mspsim
url = https://github.com/contiki-os/mspsim.git url = https://github.com/contiki-os/mspsim.git
[submodule "tools/cc2538-bsl"]
path = tools/cc2538-bsl
url = https://github.com/JelmerT/cc2538-bsl.git

View file

@ -28,3 +28,12 @@ include $(CONTIKI_CPU)/Makefile.cc2538
MODULES += core/net core/net/ipv6 core/net/mac core/net/ip \ MODULES += core/net core/net/ipv6 core/net/mac core/net/ip \
core/net/rpl core/net/rime core/net/mac/contikimac core/net/rpl core/net/rime core/net/mac/contikimac
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
%.upload: %.bin
ifeq ($(wildcard $(BSL)), )
@echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?"
else
python $(BSL) -e -w -v $<
endif

View file

@ -44,8 +44,8 @@ To start using Contiki, you will need the following:
Different tasks can be performed under different operating systems. The table below summarises what task can be performed on which OS: Different tasks can be performed under different operating systems. The table below summarises what task can be performed on which OS:
Windows Linux OS-X Windows Linux OS-X
Building Contiki Y Y N Building Contiki Y Y Y
Node Programming Y Y N Node Programming Y Y Y
Console output Console output
(UART) Y Y Y (UART) Y Y Y
(USB CDC-ACM) Y Y Y (USB CDC-ACM) Y Y Y
@ -56,7 +56,7 @@ Different tasks can be performed under different operating systems. The table be
(UART) N Y Y (UART) N Y Y
(USB CDC-ACM) N Y Y (USB CDC-ACM) N Y Y
The platform has been developed and tested under Windows XP, Mac OS X 10.7 and Ubuntu 12.04 and 12.10. The matrix above has been populated based on information for those OSs. The platform has been developed and tested under Windows XP, Mac OS X 10.9.1 and Ubuntu 12.04 and 12.10. The matrix above has been populated based on information for those OSs.
Install a Toolchain Install a Toolchain
------------------- -------------------
@ -193,9 +193,18 @@ On Linux:
Software to Program the Nodes Software to Program the Nodes
----------------------------- -----------------------------
On Windows, nodes can be programmed with TI's ArmProgConsole or the [SmartRF Flash Programmer][smart-rf-flashprog]. The README should be self-explanatory. With ArmProgConsole, upload the file with a `.bin` extension. The CC2538 can be programmed via the jtag interface or via the serial boot loader on the chip.
On Linux, nodes can be programmed with TI's [UniFlash] tool. With UniFlash, use the file with `.elf` extension. * On Windows:
* Nodes can be programmed with TI's ArmProgConsole or the [SmartRF Flash Programmer 2][smart-rf-flashprog]. The README should be self-explanatory. With ArmProgConsole, upload the file with a `.bin` extension. (jtag + serial)
* Nodes can also be programmed via the serial boot loader in the cc2538. In `tools/cc2538-bsl/` you can find `cc2538-bsl.py` this is a python script that can download firmware to your node via a serial connection. If you use this option you just need to make sure you have a working version of python installed. You can read the README in the same directory for more info. (serial)
* On Linux:
* Nodes can be programmed with TI's [UniFlash] tool. With UniFlash, use the file with `.elf` extension. (jtag + serial)
* Nodes can also be programmed via the serial boot loader in the cc2538. No extra software needs to be installed. (serial)
* On OSX:
* The `cc2538-bsl.py` script in `tools/cc2538-bsl/` is the only option. No extra software needs to be installed. (serial)
The file with a `.cc2538dk` extension is a copy of the `.elf` file. The file with a `.cc2538dk` extension is a copy of the `.elf` file.
@ -231,6 +240,8 @@ It is recommended to start with the `cc2538-demo` and `timer-test` examples unde
Strictly speaking, to build them you need to run `make TARGET=cc2538dk`. However, the example directories contain a `Makefile.target` which is automatically included and specifies the correct `TARGET=` argument. Thus, for examples under the `cc2538dk` directory, you can simply run `make`. Strictly speaking, to build them you need to run `make TARGET=cc2538dk`. However, the example directories contain a `Makefile.target` which is automatically included and specifies the correct `TARGET=` argument. Thus, for examples under the `cc2538dk` directory, you can simply run `make`.
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 cc2538-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 for this to work, see README in the `tools/cc2538-bsl` directory for more info)
For the `cc2538-demo`, the comments at the top of `cc2538-demo.c` describe in detail what the example does. For the `cc2538-demo`, the comments at the top of `cc2538-demo.c` describe in detail what the example does.
Node IEEE/RIME/IPv6 Addresses Node IEEE/RIME/IPv6 Addresses

View file

@ -40,6 +40,16 @@ typedef uint32_t rtimer_clock_t;
#define RTIMER_CLOCK_LT(a,b) ((int32_t)((a)-(b)) < 0) #define RTIMER_CLOCK_LT(a,b) ((int32_t)((a)-(b)) < 0)
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/**
* \name Serial Boot Loader Backdoor configuration
*
* @{
*/
#ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR
#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /**<Enable the boot loader backdoor */
#endif
/** @} */
/*---------------------------------------------------------------------------*/
/** /**
* \name USB 'core' configuration * \name USB 'core' configuration
* *

View file

@ -63,6 +63,15 @@ void cc2538_rf_err_isr(void);
void udma_isr(void); void udma_isr(void);
void udma_err_isr(void); void udma_err_isr(void);
/* Boot Loader Backdoor selection */
#if FLASH_CCA_CONF_BOOTLDR_BACKDOOR
/* Backdoor enabled, on PA_3 (Select button) */
#define FLASH_CCA_BOOTLDR_CFG (FLASH_CCA_BOOTLDR_CFG_ENABLE \
| ((3 << FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S) & FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_M))
#else
#define FLASH_CCA_BOOTLDR_CFG FLASH_CCA_BOOTLDR_CFG_DISABLE
#endif
/* Link in the USB ISR only if USB is enabled */ /* Link in the USB ISR only if USB is enabled */
#if USB_SERIAL_CONF_ENABLE #if USB_SERIAL_CONF_ENABLE
void usb_isr(void); void usb_isr(void);
@ -95,7 +104,7 @@ extern uint8_t _text[0];
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
__attribute__ ((section(".flashcca"), used)) __attribute__ ((section(".flashcca"), used))
const flash_cca_lock_page_t __cca = { const flash_cca_lock_page_t __cca = {
FLASH_CCA_BOOTLDR_CFG_DISABLE, /* Bootloader backdoor disabled */ FLASH_CCA_BOOTLDR_CFG, /* Boot loader backdoor configuration */
FLASH_CCA_IMAGE_VALID, /* Image valid */ FLASH_CCA_IMAGE_VALID, /* Image valid */
&_text, /* Vector table located at the start of .text */ &_text, /* Vector table located at the start of .text */
/* Unlock all pages and debug */ /* Unlock all pages and debug */

1
tools/cc2538-bsl Submodule

@ -0,0 +1 @@
Subproject commit 1223bfe03cdb31c439f1a51593808cdabc1939d2