BadgeWX Firmware and Test Code
Binary assets are included and managed by Git LFS. See "_Binary_Assets_Are_GitLFS_Managed-README.txt" for more details. Most are in the Releases subfolder and are important since there are multiple sources and multiple binaries that work together to make a complete product release.
- Program - Scripts/tools used in generating the firmware/binary image files
- Release - Generated firmware/binary image files
- Boot - BadgeWX boot system "autorun" files from generated within Source/Boot/...
- Core - BadgeWX firmware and user filesystem (for built-in ESP8266-based Wi-Fi module)
- Power - ATTiny microcontroller binary image (soft-power button controller)
- Test - Special boot + configuration for testing BadgeWX; intended for SD-card use
- Source
- Boot - Autorun files' source code
- Examples - Default source examples (.html, .png), if any, for user filesystem
- Power - ATTiny soft-power button source code
- Test - Test application source code (autorun.bin) and Wi-Fi credentials (wifi.txt) for SD card
The following needs to be installed on the development computer before proceeding with development. Most of this software supports Windows only, so a Windows computer will be assumed.
- Propeller Tool
- Simple IDE
- Atmel Studio
- Python v3.6.5
- Esptool - After Python install, open command prompt and enter: python -m pip install esptool
- If needed, here are more details about Esptool for Python.
The Release consists of many Build/Release parts; perform any or all of the build steps and/or release steps (below) as necessary.
- autorun.bin - Compile Source/Boot/autorun/autorun.spin with Propeller Tool and save as autorun.bin (in same folder)
- autorunBL.bin - Compile Source/Boot/autorun/BadgeWX-Bootloader.side (c project) with SimpleIDE
- Ensure it saved a .binary of the image (should be in cmm subfolder) and rename it to autorunBL.bin
- autorunSD.bin - Compile Source/Boot/autorun/autorunSD.spin with Propeller Tool and save as autorunSD.bin (in same folder)
- Examples - If any examples are to be included in the user filesystem (.html, .gif, .jpg, .png), place them in the Source/Examples folder
- Follow Release instructions (below)
- "Make" the Wi-Fi firmware from the Parallax-ESP repository
$ cd <Parallax-ESP_folder>
$ make clean
$ make EXTRA_CFLAGS=-DAUTO_LOAD
- Follow Release instructions (below)
- Compile the Source/Power/BadgeWX_PowerT10 project with AtmelStudio
- This will generate a .hex file in its Release subfolder
- Follow Release instructions (below)
- Compile Source/Test/BadgeWX_Autorun_TESTCODE.spin with Propeller Tool and save as autorun.bin (in same folder)
- Follow Release instructions (below)
In a Git Bash command line window on a Windows computer, navigate to this repository's Program subfolder and perform one or more of the following...
After building any one or more of the above components...
- Run the release script:
$ ./release.bat
- This updates the Release/Boot, Core, Power, and Test folders (as necessary) with .hex and .bin files from Source and builds the Release/Core/fsimage.bin file (the user filesystem image)
- Optionally, you may run only the release_filesystem script:
$ ./release_filesystem.bat
- This updates the Release/Boot folder (if necessary) with .bin files from Source/Boot... subfolders and builds the Release/Core/fsimage.bin file (the user filesystem image)
- Perform Full Release, or individual release steps, as described, then...
- Manually copy the following files from the Propeller-ESP repository build processes' resulting "build" folder into the Release/Core subfolder of this repository
- httpd.ota
- httpd.user1.bin
- httpd.user2.bin
- Optionally, you may run only the release_power script:
$ ./release_power.bat
- This updates the Release/Power folder (if necessary) with the .hex file
- Optionally, you may run only the release_test script:
$ ./release_test.bat
- This updates the Release/Test folder (if necessary) with the autorun.bin file
For each badge, the Power button firmware needs to be programmed in first, followed by the Core firmware. Normally, the test jig will be used to do this automatically; however, if manual programming must be done, here are some tips.
- Connect a PropPlug to the appropriate pins on the BadgeWX or test jig (Gnd, Res, Tx, Rx)
- Power on the board/jig
- Start Atmel Studio
- Choose the "Device Programming" menu item
- Set "Tool" to Atmel-ICE
- Set "Device" to ATtiny10
- Set "Interface" to TPI, click Apply
- Click Read The "Target Voltage" should read around 4.5 V
- Select Memories
- Set "Flash (1 KB)" field to path of BadgeWX_PowerT10.hex file
- Checkmark "Erase device before programming"
- Checkmark "Verify Flash after programming"
- Click the Program button
- Open a command-line window and navigate to this folder
- Connect a PropPlug to the appropriate pins on the BadgeWX or test jig (Gnd, Res, Tx, Rx)
- Ground the PGM pin
- Power on the board/jig
- Perform the Erase procedure (replacing <com_port> with appropriate port name)
$ python -m esptool --baud 921600 --port <com_port> --before no_reset --after no_reset erase_flash
EXAMPLE OUTPUT:
esptool.py v2.4.1
Serial port com7
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: b4:e6:2d:2d:50:f1
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Erasing flash (this may take a while)...
Chip erase completed successfully in 3.6s
Staying in bootloader.
- Perform the Programming procedure (replacing <com_port> with appropriate port name)
$ python -m esptool --baud 921600 --port <com_port> --before no_reset --after no_reset write_flash 0x00000 boot_v1.6.bin 0x01000 httpd.user1.bin 0x100000 fsimage.bin 0x3FC000 esp_init_data_default.bin
EXAMPLE OUTPUT:
esptool.py v2.4.1
Serial port com7
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: b4:e6:2d:2d:50:f1
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x004f
Compressed 3856 bytes to 2763...
Wrote 3856 bytes (2763 compressed) at 0x00000000 in 0.1 seconds (effective 385.6 kbit/s)...
Hash of data verified.
Compressed 318964 bytes to 240304...
Wrote 318964 bytes (240304 compressed) at 0x00001000 in 3.4 seconds (effective 741.9 kbit/s)...
Hash of data verified.
Compressed 120148 bytes to 66192...
Wrote 120148 bytes (66192 compressed) at 0x00100000 in 1.1 seconds (effective 883.4 kbit/s)...
Hash of data verified.
Compressed 128 bytes to 75...
Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 21.3 kbit/s)...
Hash of data verified.
Leaving...
Staying in bootloader.
OLD PROGRAMMING METHOD) The following is the appropriate erase+program statement for the old esptool Windows executable (no longer used):
$ ./esptool -cd none -cb 921600 -cp <com_port> -bz 4M -bf 80 -bm qio -ca 0x00000 -cf boot_v1.6.bin -ca 0x01000 -cf httpd.user1.bin -ca 0x7e000 -cf blank.bin -ca 0x7f000 -cf blank.bin -ca 0x100000 -cf fsimage.bin -ca 0x3FA000 -cf blank.bin -ca 0x3FC000 -cf esp_init_data_default.bin -ca 0x3FE000 -cf blank.bin