From 34e48f423341366d43c9bbfa2754d425509f6c8a Mon Sep 17 00:00:00 2001 From: Jelmer Tiete Date: Sun, 2 Feb 2014 00:46:45 +0100 Subject: [PATCH] Added bootloader backdoor configuration for cc2538DK in contiki-conf.h and selector in startup-gcc.c. Updated Makefile.cc2538dk to support direct uploading. Also updated the platform readme to include the workflow with cc2538-bsl. --- platform/cc2538dk/Makefile.cc2538dk | 9 +++++++++ platform/cc2538dk/README.md | 21 ++++++++++++++++----- platform/cc2538dk/contiki-conf.h | 10 ++++++++++ platform/cc2538dk/startup-gcc.c | 11 ++++++++++- 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/platform/cc2538dk/Makefile.cc2538dk b/platform/cc2538dk/Makefile.cc2538dk index 397fbb978..be10a9ce9 100644 --- a/platform/cc2538dk/Makefile.cc2538dk +++ b/platform/cc2538dk/Makefile.cc2538dk @@ -28,3 +28,12 @@ include $(CONTIKI_CPU)/Makefile.cc2538 MODULES += core/net core/net/ipv6 core/net/mac core/net/ip \ 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 diff --git a/platform/cc2538dk/README.md b/platform/cc2538dk/README.md index 5b4b66869..ee59cfc9c 100644 --- a/platform/cc2538dk/README.md +++ b/platform/cc2538dk/README.md @@ -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: Windows Linux OS-X - Building Contiki Y Y N - Node Programming Y Y N + Building Contiki Y Y Y + Node Programming Y Y Y Console output (UART) 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 (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 ------------------- @@ -193,9 +193,18 @@ On Linux: 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. @@ -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`. +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. Node IEEE/RIME/IPv6 Addresses diff --git a/platform/cc2538dk/contiki-conf.h b/platform/cc2538dk/contiki-conf.h index b238c9a27..f3d184dad 100644 --- a/platform/cc2538dk/contiki-conf.h +++ b/platform/cc2538dk/contiki-conf.h @@ -40,6 +40,16 @@ typedef uint32_t rtimer_clock_t; #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 /**