Avnet IoT Starter Kit App Reflash with OS X v3.zip

Solved
chucklink's picture
chucklink
Junior(4)

Just in case somebody else besides me uses OS X, I put together a reflash package that supports both Windows and MAC OS X.  Actually I did not change V2 of the Avent IoT kit, but I added the tools necessary for OS X support and I modified the original script to support OS X using a BASH shell.  I modified the shell script to send "error" information to the openocd.log and the console comes to the console.   Feel free to copy, modify and do whatever you need to do and enjoy the fact that you don't have to break out that old Windows laptop just to get your demo working.  For the Avnet guys, the makefile still dies when I attemp to use the version that "download_apps".  I am still working on that.  I don't know how to upload files to this forum but I will upload the zip package when I learn how.

#!/bin/bash

#Programs aws_iot_shadow application into Avnet AWS platform

JTAG_CFG=./tools/OpenOCD/BCM9WCD1EVAL1.cfg
MCU_CFG=./tools/OpenOCD/stm32f4x.cfg
FLASH_CFG=./tools/OpenOCD/stm32f4x-flash-app.cfg

echo "----------------------------------------------------"
echo " Avnet BCM4343W IoT Starter Kit Programming Utility " 
echo " Reprograms IoT Starter Kit with AWS IoT Shadow App."
echo " Modified for OS X by Chuck Link, M2MD Technologies " 
echo "----------------------------------------------------"

echo " Erasing MCU Flash and programming 3 files..."
./tools/OpenOCD/OSX/openocd-all-brcm-libftdi -f $JTAG_CFG -f $MCU_CFG -f $FLASH_CFG -c "flash erase_sector 0 0 last" -c "flash write_image aws/waf.bootloader-NoOS-BCM94343W_AVN.stripped.elf"\
 -c "flash write_image aws/DCT.stripped.elf" -c "flash write_image aws/demo.aws_iot.shadow-BCM94343W_AVN.stripped.elf" -c shutdown 2>openocd.log

echo " Erasing SPI flash and programming 2 files..."
./tools/OpenOCD/OSX/openocd-all-brcm-libftdi -f $JTAG_CFG -f $MCU_CFG -f ./sflash_write.tcl -c "sflash_erase BCM94343W_AVN-SDIO 0" -c "sflash_write_file binaries/4343WA1.bin 4096 BCM94343W_AVN-SDIO 0 0"\
 -c "sflash_write_file aws/APPS.bin 0x0000 BCM94343W_AVN-SDIO 0 0" -c shutdown 2>>openocd.log

echo " Re-programming of MCU and SPI Flash completed!"

echo " Restarting the board ..."
./tools/OpenOCD/OSX/openocd-all-brcm-libftdi -f $JTAG_CFG -f $MCU_CFG -f $FLASH_CFG -c  init -c "reset run" -c shutdown 2>>openocd.log

echo "----------------------------------------------------"

 

 

PeterF's picture
PeterF
Moderator(16)

Thanks for sharing your OS X adapted version of the batch file. 

What problem specifically are you running into when using the download_apps parameter in your make target?  

 

Note: The download_apps parameter is used to relocate the BCM4343W firmware download file to external SPI flash memory rather than taking-up space in the STM32F411 MCU's on-chip flash memory. This not necessary in the case of small examples (eg. snip.scan) but is essential for larger applications 

chucklink's picture
chucklink
Junior(4)

As you can see below, in the make process, there is a segmentation fault. Initially I thought it was in the download_apps portion, but I've been able to determine that there is absolutely nothing wrong with the download process based on the modification of your reflash script. Somewhere there is something that causes the make process to "seg fault", but only when the download_apps is selected. It appears to be making the bootloader and serial flash loader correctly. I'm not an expert on Eclipse so I don't exactly know how things are controlled whether serially or overlapped. I believe that some of the process is overlapped and something is not completed before something else starts and then it faults. This process does work on a Windows 7 implementation.

I fully agree, and anything that I run today that does not use the "download_apps" works perfectly. Unfortunately my real code is larger than I can fit in the 512K when I add the WiFi firmware into the equation. Strangely the original make file for the BCM eval board:
make demo.aws_iot.shadow-BCM943362WCD4 download download_apps run
runs perfectly for the BCM board but it uses a completely different set of make files.

Regarding the OS X reflash, I have a zip package of the files moved from the OS X version that I can upload somewhere if you have a desire for it. It is not difficult, but for somebody else without the full understanding it can get them going fast, especially since there is no other way to get one of the early boards working using OS X without a little help.

RAM Initialisation | 2788 | 0 |
resources | 55188 | 0 |
Ring_Buffer | 92 | 0 |
SPI_Flash_Library_BCM94343W_AVN | 512 | 0 |
Startup Stack & Link Script fill | 49 | 18 |
Supplicant - BESL | 37232 | 536 |
ThreadX | 8588 | 396 |
TLV | 200 | 0 |
WICED | 4739 | 968 |
Wiced_RO_FS | 568 | 0 |
WWD | 15973 | 3048 |
----------------------------------+---------+---------|
TOTAL (bytes) | 300860 | 57936 |
----------------------------------|---------|---------|
Downloading Bootloader ...
make: *** [main_app] Segmentation fault: 11
No changes detected
Download complete

PeterF's picture
PeterF
Moderator(16)

Your last question in context of OS X and that Segmentation fault will be better answered on the Broadcom WICED WiFI forum. This is not something specific to the Avnet board and is outside of the scope of this support forum.

 

Anecdotal feedback from technical resources here, is the recommendation that you should consider rather using the Windows version of WICED SDK 3.5.2 

chucklink's picture
chucklink
Junior(4)

 

Got it resolved.  It turns out that "jone" on Wiced forum made note of it over a year ago.  I thought I complied with his fix, but maybe I missed something, since I did the fix from memory.  Anyway, for anybody else, the fix is to copy the OS X make into the SDK.

cd /Applications/WICED/WICED-SDK-3.5.2/tools/common/OSX

mv make make.old

cp /usr/bin/make ./make

Then you should be good!  I have a more complete description on the Wiced forum, but the above instructions fix the problem.  

Chuck

 

 

PeterF's picture
PeterF
Moderator(16)

Thanks for sharing your solution on this