From 80e29ad6a058677c5f12259b6b2e72a999e387d7 Mon Sep 17 00:00:00 2001 From: Jelmer Tiete Date: Sun, 8 Nov 2015 23:51:13 -0800 Subject: [PATCH 1/8] Pulled in cc2538-bsl submodule v2.0 (f1f070d) --- tools/cc2538-bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cc2538-bsl b/tools/cc2538-bsl index 1223bfe03..f1f070df5 160000 --- a/tools/cc2538-bsl +++ b/tools/cc2538-bsl @@ -1 +1 @@ -Subproject commit 1223bfe03cdb31c439f1a51593808cdabc1939d2 +Subproject commit f1f070df5ef47cefcc172593f0be450f85d2245f From 97095c8bb58e70197d182ab5d2c1b0336e77e629 Mon Sep 17 00:00:00 2001 From: Jelmer Tiete Date: Mon, 9 Nov 2015 00:29:49 -0800 Subject: [PATCH 2/8] Updated makefiles of srf06 platform to support uploading via cc2538-bsl script --- platform/srf06-cc26xx/srf06/Makefile.srf06 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/platform/srf06-cc26xx/srf06/Makefile.srf06 b/platform/srf06-cc26xx/srf06/Makefile.srf06 index d94181927..3459cbadc 100644 --- a/platform/srf06-cc26xx/srf06/Makefile.srf06 +++ b/platform/srf06-cc26xx/srf06/Makefile.srf06 @@ -3,3 +3,19 @@ CFLAGS += -DBOARD_SMARTRF06EB=1 CONTIKI_TARGET_DIRS += srf06 BOARD_SOURCEFILES += leds-arch.c srf06-sensors.c button-sensor.c board.c + +PYTHON = python +BSL_FLAGS += -e -w -v + +ifdef PORT + BSL_FLAGS += -p $(PORT) +endif + +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) $(BSL_FLAGS) $< +endif From d01d53978c73ae8c0229db13002e041cfe3c57bb Mon Sep 17 00:00:00 2001 From: Jelmer Tiete Date: Mon, 9 Nov 2015 01:34:42 -0800 Subject: [PATCH 3/8] Removed forced upload speed for the RE-MOTE platform --- platform/remote/Makefile.remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/remote/Makefile.remote b/platform/remote/Makefile.remote index 3d351bfdd..fc530967c 100644 --- a/platform/remote/Makefile.remote +++ b/platform/remote/Makefile.remote @@ -5,7 +5,7 @@ ifndef CONTIKI endif PYTHON = python -BSL_FLAGS += -e -w -v -b 115200 +BSL_FLAGS += -e -w -v ifdef PORT BSL_FLAGS += -p $(PORT) From 9a8e749f6f4173540f577527965de9f8d83f28cf Mon Sep 17 00:00:00 2001 From: Jelmer Tiete Date: Mon, 9 Nov 2015 02:10:33 -0800 Subject: [PATCH 4/8] Updated cc26xx Readme to mention serial upload script --- platform/srf06-cc26xx/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/srf06-cc26xx/README.md b/platform/srf06-cc26xx/README.md index 1e7226997..77bfe73cb 100644 --- a/platform/srf06-cc26xx/README.md +++ b/platform/srf06-cc26xx/README.md @@ -102,7 +102,10 @@ To use the port you need: as a submodule when you clone Contiki. * TI's CC13xxware sources. The correct version will be installed automatically as a submodule when you clone Contiki. -* Software to program the nodes. Use TI's SmartRF Flash Programmer +* Contiki can automatically upload firmware to the nodes over serial with the + included [cc2538-bsl script](https://github.com/JelmerT/cc2538-bsl). + Note that uploading over serial doesn't work for the Sensortag, you can use + TI's SmartRF Flash Programmer in this case. * A toolchain to build firmware: The port has been developed and tested with GNU Tools for ARM Embedded Processors . The port was developed and tested using this version: From 6a40a4b7491abd3854b7f94959f6b38d1d0378ec Mon Sep 17 00:00:00 2001 From: Jelmer Tiete Date: Mon, 9 Nov 2015 14:36:13 -0800 Subject: [PATCH 5/8] Updated cc2538-bsl submodule to 6185d8b, small bugfix --- tools/cc2538-bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cc2538-bsl b/tools/cc2538-bsl index f1f070df5..6185d8b16 160000 --- a/tools/cc2538-bsl +++ b/tools/cc2538-bsl @@ -1 +1 @@ -Subproject commit f1f070df5ef47cefcc172593f0be450f85d2245f +Subproject commit 6185d8b16f10047053fd57000a552340273d7d85 From 715946ece30a1b3aeafb30484cd7c2f72ea0db3f Mon Sep 17 00:00:00 2001 From: Jelmer Tiete Date: Mon, 9 Nov 2015 15:36:17 -0800 Subject: [PATCH 6/8] Restructured cc26xx readme, included use of .upload and PORT variable. Added sleepy demo example to examples section. --- platform/srf06-cc26xx/README.md | 106 +++++++++++++++++--------------- 1 file changed, 55 insertions(+), 51 deletions(-) diff --git a/platform/srf06-cc26xx/README.md b/platform/srf06-cc26xx/README.md index 77bfe73cb..f17d50a61 100644 --- a/platform/srf06-cc26xx/README.md +++ b/platform/srf06-cc26xx/README.md @@ -45,16 +45,64 @@ In terms of hardware support, the following drivers have been implemented: * Buzzer * External SPI flash +Requirements +============ +To use the port you need: + +* TI's CC26xxware sources. The correct version will be installed automatically + as a submodule when you clone Contiki. +* TI's CC13xxware sources. The correct version will be installed automatically + as a submodule when you clone Contiki. +* Contiki can automatically upload firmware to the nodes over serial with the + included [cc2538-bsl script](https://github.com/JelmerT/cc2538-bsl). + Note that uploading over serial doesn't work for the Sensortag, you can use + TI's SmartRF Flash Programmer in this case. +* A toolchain to build firmware: The port has been developed and tested with + GNU Tools for ARM Embedded Processors . + The port was developed and tested using this version: + + $ arm-none-eabi-gcc -v + [...] + gcc version 4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278] (GNU Tools for ARM Embedded Processors) + +* srecord (http://srecord.sourceforge.net/) +* You may also need other drivers so that the SmartRF can communicate with your +operating system and so that you can use the chip's UART for I/O. Please read +the section ["Drivers" in the CC2538DK readme](https://github.com/contiki-os/contiki/tree/master/platform/cc2538dk#drivers). + Examples ======== -The port comes with two examples: A very basic example and a mode advanced one -(web demo). The former demonstrates how to read sensors and how to use board -peripherals. It also demonstrates how to send out BLE advertisements. -The latter includes a CoAP server, an MQTT client which connects and publishes -to the IBM quickstart service, a net-based UART and lastly a web server that -can be used to configure the rest of the example. +The port comes with three examples: +- A very basic example which demonstrates how to read sensors and how to use board peripherals. It also demonstrates how to send out BLE advertisements. +- A more advanced one (web demo) which includes a CoAP server, an MQTT client which connects and publishes to the IBM quickstart service, a net-based UART and lastly a web server that can be used to configure the rest of the example. +- An example demonstrating a very sleepy node. -More details about those two examples can be found in their respective READMEs. +More details about those three examples can be found in their respective READMEs. + +Build your First Example +------------------------ +It is recommended to start with the `cc26xx-demo` example under `examples/cc26xx/`. This is a very simple example which will help you get familiar with the hardware and the environment. This example can be used for the Sensortag and SmartRF06 EB. + +Strictly speaking, to build it you need to run `make TARGET=srf06-cc26xx BOARD=srf06/cc26xx`. However, the example directories contain a `Makefile.target` which is automatically included and specifies the correct `TARGET=` argument. The `BOARD=` environment variable defaults to `srf06/cc26xx` (which is the SmartRF06 EB + CC26XXEM). Thus, for examples under the `cc26xx` directory, and when using the SmartRF06 EB, you can simply run `make`. + +Other options for the `BOARD` make variable are: + +* Srf06+CC26xxEM: Set `BOARD=srf06/cc26xx` +* Srf06+CC13xxEM: Set `BOARD=srf06/cc13xx` +* CC2650 tag: Set `BOARD=sensortag/cc2650` + +If the `BOARD` variable is unspecified, an image for the Srf06 CC26XXEM will be built. + +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` + +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`. CC13xx/CC26xx Border Router over UART ===================================== @@ -94,31 +142,6 @@ that limit the size of the uIP buffer. Removing the two lines below from Do not forget to set the correct channel by defining `RF_CORE_CONF_CHANNEL` as required. -Requirements -============ -To use the port you need: - -* TI's CC26xxware sources. The correct version will be installed automatically - as a submodule when you clone Contiki. -* TI's CC13xxware sources. The correct version will be installed automatically - as a submodule when you clone Contiki. -* Contiki can automatically upload firmware to the nodes over serial with the - included [cc2538-bsl script](https://github.com/JelmerT/cc2538-bsl). - Note that uploading over serial doesn't work for the Sensortag, you can use - TI's SmartRF Flash Programmer in this case. -* A toolchain to build firmware: The port has been developed and tested with - GNU Tools for ARM Embedded Processors . - The port was developed and tested using this version: - - $ arm-none-eabi-gcc -v - [...] - gcc version 4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278] (GNU Tools for ARM Embedded Processors) - -* srecord (http://srecord.sourceforge.net/) -* You may also need other drivers so that the SmartRF can communicate with your -operating system and so that you can use the chip's UART for I/O. Please read -the section ["Drivers" in the CC2538DK readme](https://github.com/contiki-os/contiki/tree/master/platform/cc2538dk#drivers). - Filename conflicts between Contiki and CC26xxware ================================================= There is a file called `timer.c` both in Contiki as well as in CC26xxware. The @@ -127,25 +150,6 @@ start using it at some point, you will need to rename it: From `cpu/cc26xx/lib/cc26xxware/driverlib/timer.c` to `driverlib-timer.c` -Sensortag vs Srf06 -================== -To build for the sensortag, you will need to set the `BOARD` make variable as -follows: - -* Srf06+CC26xxEM: Set `BOARD=srf06/cc26xx` -* Srf06+CC13xxEM: Set `BOARD=srf06/cc13xx` -* CC2650 tag: Set `BOARD=sensortag/cc2650` - -You can do that by exporting `BOARD` as an environment variable, by adding it -to your Makefile or by adding it to your make command as an argument. - -If the `BOARD` variable is unspecified, an image for the Srf06 CC26XXEM will be -built. - -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. - Sensortag UART usage (with or without the Debugger Devpack) =========================================================== There are two ways to get debugging (printf etc) output from the Sensortag. From 1efeda4283e9ee68fa18479b2f2e1fd8f97e5d4b Mon Sep 17 00:00:00 2001 From: Jelmer Tiete Date: Mon, 23 Nov 2015 11:28:34 -0800 Subject: [PATCH 7/8] Added the PORT make variable to the cc2538dk and Remote makefile. Fixed bug in these makefiles on OSX introduced in #1162 --- platform/cc2538dk/Makefile.cc2538dk | 9 ++++++++- platform/remote/Makefile.remote | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/platform/cc2538dk/Makefile.cc2538dk b/platform/cc2538dk/Makefile.cc2538dk index f962a0fa7..dfce1f375 100644 --- a/platform/cc2538dk/Makefile.cc2538dk +++ b/platform/cc2538dk/Makefile.cc2538dk @@ -28,11 +28,18 @@ MODULES += core/net core/net/mac \ core/net/mac/contikimac \ core/net/llsec +PYTHON = python +BSL_FLAGS += -e -w -v -a $$($(OBJDUMP) -h $*.elf | grep -B1 LOAD | grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | sort -g | head -1) + +ifdef PORT + BSL_FLAGS += -p $(PORT) +endif + BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py %.upload: %.bin %.elf 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 -a $$($(OBJDUMP) -h $*.elf | sed -n '/\/{g;1!p;};h' | awk '{print "0x" $$5}' | sort -g | head -1) $< + $(PYTHON) $(BSL) $(BSL_FLAGS) $< endif diff --git a/platform/remote/Makefile.remote b/platform/remote/Makefile.remote index fc530967c..b91183b1e 100644 --- a/platform/remote/Makefile.remote +++ b/platform/remote/Makefile.remote @@ -36,11 +36,18 @@ MODULES += core/net core/net/mac \ core/net/mac/contikimac \ core/net/llsec +PYTHON = python +BSL_FLAGS += -e -w -v -a $$($(OBJDUMP) -h $*.elf | grep -B1 LOAD | grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | sort -g | head -1) + +ifdef PORT + BSL_FLAGS += -p $(PORT) +endif + BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py %.upload: %.bin %.elf ifeq ($(wildcard $(BSL)), ) @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" else - $(PYTHON) $(BSL) $(BSL_FLAGS) -a $$($(OBJDUMP) -h $*.elf | sed -n '/\/{g;1!p;};h' | awk '{print "0x" $$5}' | sort -g | head -1) $< + $(PYTHON) $(BSL) $(BSL_FLAGS) $< endif From e75bdd00e71c08b0ceef3ea8a6c4703b55723cc9 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Tue, 24 Nov 2015 13:08:12 +0000 Subject: [PATCH 8/8] Remove duplicate block and define the argument of -a using $(shell) --- platform/cc2538dk/Makefile.cc2538dk | 7 +++++-- platform/remote/Makefile.remote | 12 ++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/platform/cc2538dk/Makefile.cc2538dk b/platform/cc2538dk/Makefile.cc2538dk index dfce1f375..4dbeb6d03 100644 --- a/platform/cc2538dk/Makefile.cc2538dk +++ b/platform/cc2538dk/Makefile.cc2538dk @@ -29,7 +29,7 @@ MODULES += core/net core/net/mac \ core/net/llsec PYTHON = python -BSL_FLAGS += -e -w -v -a $$($(OBJDUMP) -h $*.elf | grep -B1 LOAD | grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | sort -g | head -1) +BSL_FLAGS += -e -w -v ifdef PORT BSL_FLAGS += -p $(PORT) @@ -41,5 +41,8 @@ BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py ifeq ($(wildcard $(BSL)), ) @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" else - $(PYTHON) $(BSL) $(BSL_FLAGS) $< + $(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \ + grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \ + sort -g | head -1)) + $(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $< endif diff --git a/platform/remote/Makefile.remote b/platform/remote/Makefile.remote index b91183b1e..a261cb686 100644 --- a/platform/remote/Makefile.remote +++ b/platform/remote/Makefile.remote @@ -36,18 +36,14 @@ MODULES += core/net core/net/mac \ core/net/mac/contikimac \ core/net/llsec -PYTHON = python -BSL_FLAGS += -e -w -v -a $$($(OBJDUMP) -h $*.elf | grep -B1 LOAD | grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | sort -g | head -1) - -ifdef PORT - BSL_FLAGS += -p $(PORT) -endif - BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py %.upload: %.bin %.elf ifeq ($(wildcard $(BSL)), ) @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" else - $(PYTHON) $(BSL) $(BSL_FLAGS) $< + $(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \ + grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \ + sort -g | head -1)) + $(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $< endif