GithubHelp home page GithubHelp logo

autosportlabs / asl_f4_bootloader Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 4.0 3.21 MB

SD card based bootloader for STM32F407

License: GNU General Public License v2.0

Makefile 0.10% C 95.66% Python 0.12% Assembly 2.24% HTML 1.87% Batchfile 0.01%

asl_f4_bootloader's People

Contributors

brentpicasso avatar ddimensia avatar jeff-ciesielski avatar stieg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asl_f4_bootloader's Issues

Fix Tagging issues

Currently we have no solid tagging so its hard to know what release is what. Fix this up as best as possible.

asl_f4_fw_postprocess does not create binary identical .ihex files across platforms

In my attempts to debug the root cause of autosportlabs/RaceCapture-Pro_firmware#753 I have learned that the f4_fw_postprocesser does not generate the same ihex code across platforms given the same .elf file. This behavior is isolated to RCT builds; mk2 builds are not affected. See the following output:

Jenkins:

[jenkins@ip-172-30-0-247 rct]$ python --version; sha256sum main.elf; asl_f4_fw_postprocess -f main.bin -e main.elf -o 0x08004000 -i main.ihex; sha256sum main.ihex
Python 2.7.5
2dfb53dd48b63d7511c0566039fd2c9ff52b136c5f54b754cf04d913c9c2c90d  main.elf
Found info block @ offset: 0x24c1c
Application CRC: 0x4fb122d9L
Info CRC: 0x69ba6a3bL
Application length: 169252
33dbcbfb85e55d9d8883f0321f6125dfbf60984b51f56b71ac61d460ad0dcb22  main.ihex

My Local Build Env:

[stieg@lucious rct]$ python --version; sha256sum main.elf; asl_f4_fw_postprocess -f main.bin -e main.elf -o 0x08004000 -i main.ihex; sha256sum main.ihex
Python 2.7.11
2dfb53dd48b63d7511c0566039fd2c9ff52b136c5f54b754cf04d913c9c2c90d  main.elf
Found info block @ offset: 0x24c1c
Application CRC: 0x4fb122d9L
Info CRC: 0x69ba6a3bL
Application length: 169252
3fb6003a03e75db7e8aea68676f72804177d9bde49dbec43cc87d65b0bf937c1  main.ihex

Not sure if its something related to the platform or the python version, but it does cause the bootloader on RCT to get corrupted. The top build causes the bootloader region to be smashed while the bottom build works just fine.

Loader Does Not Successfully Reset CPU After Flash

Upon flashing the unit the loader will not successfully reset the CPU back into the newly flashed code. Instead it gets stuck someplace. How to reproduce:

  1. Plug in rct/mk2, and ensure you can talk to it in Minicom
  2. Flash any version of 2.10.0 or 2.9.x firmware

Notice that the unit does not reset properly after flash. Firmware seems to handle this well.

Firmware version doesn't report correctly on bootloader

Seems the bugfix portion is incorrect (reports 0.3.0 when it should be 0.3.2):

[stieg@lucious f4_bootloader]$ make flash
openocd -f board/mk2/debug.ocd -f flash.ocd
Open On-Chip Debugger 0.9.0 (2016-05-13-19:37)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
WARNING: target/stm32f4x_stlink.cfg is deprecated, please switch to target/stm32f4x.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v24 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.243541
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08002914 msp: 0x20020000
** Programming Started **
auto erase enabled
Info : device id = 0x10016413
Info : flash size = 512kbytes
Info : Padding image section 0 with 1892 bytes
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x20000042 msp: 0x20020000
wrote 16384 bytes from file main.elf in 0.810974s (19.729 KiB/s)
** Programming Finished **
** Verify Started **
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000
verified 12124 bytes in 0.201107s (58.873 KiB/s)
** Verified OK **
[stieg@lucious f4_bootloader]$ pkill -f minicom; sleep 1; echo -ne "q\r\nsysReset 1\r\n" >/dev/ttyACM0; asl_f4_loader -f ~/Downloads/RaceCapturePro_MK2_2.10.0_RC1-153-ge746a10/RaceCapturePro_MK2_2.10.0_RC1-153-ge746a10.ihex 
Place your device into bootloader mode and then press any key
Searching for an active bootloader
Found bootloader ver: 0.3.0 on: /dev/ttyACM0
Updating firmware...
[**************************************************] 100%

Verifying firmware
Firmware was valid
Starting firmware

ImportError: No module named asl_f4_loader.fw_postprocess

Trying to get things building on a Jesse Vagrant (for mac development) and am hitting this error

asl_f4_fw_postprocess -f main.bin -o 0x08020000 -b main.bin -i main.ihex
Traceback (most recent call last):
  File "/usr/local/bin/asl_f4_fw_postprocess", line 9, in <module>
    load_entry_point('asl-f4-loader==0.0.6', 'console_scripts', 'asl_f4_fw_postprocess')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])

I can't tell if I'm installing it wrong or if there is an actual bug here. Followed README and tried to install using both sudo pip -e <path to project> and sudo python setup.py install from within the project. But no go :(

ASL_f4_loader fails to recognize RCT on USB3

When I attempt to flash my firmware on RCT using USB3 I see the following stack trace from the loader:

[stieg@lucious firmware]$ asl_f4_loader -p /dev/ttyACM0 -f platform/rct/main.ihex 
Place your device into bootloader mode and then press any key
Updating firmware...
[                                                  ] 0%Traceback (most recent call last):
  File "/usr/bin/asl_f4_loader", line 9, in <module>
    load_entry_point('asl-f4-loader==0.1.0', 'console_scripts', 'asl_f4_loader')()
  File "build/bdist.linux-x86_64/egg/asl_f4_loader/fw_update.py", line 253, in main
  File "build/bdist.linux-x86_64/egg/asl_f4_loader/fw_update.py", line 174, in update_firmware
Exception: Error flashing device, no response!

and I see the following message in my dmesg output:

[87147.582242] usb 3-2: new full-speed USB device number 7 using xhci_hcd
[87147.747037] usb 3-2: New USB device found, idVendor=16d0, idProduct=07f1
[87147.747041] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87147.747042] usb 3-2: Product: RaceCapture Track
[87147.747044] usb 3-2: Manufacturer: Autosport Labs
[87147.747045] usb 3-2: SerialNumber: 205D31644333
[87147.747506] cdc_acm 3-2:1.0: ttyACM0: USB ACM device
[87195.896164] cdc_acm 3-2:1.0: failed to set dtr/rts
[87230.639454] cdc_acm 3-2:1.0: failed to set dtr/rts
[87233.323891] cdc_acm 3-2:1.0: failed to set dtr/rts

When I plug into USB2 I see the following in dmesg:

[87385.297364] usb 3-2: USB disconnect, device number 7
[87388.234798] usb 1-1.2: new full-speed USB device number 31 using ehci-pci
[87388.322727] usb 1-1.2: New USB device found, idVendor=16d0, idProduct=07f1
[87388.322734] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87388.322738] usb 1-1.2: Product: RaceCapture Track
[87388.322741] usb 1-1.2: Manufacturer: Autosport Labs
[87388.322743] usb 1-1.2: SerialNumber: 205D31644333
[87388.323467] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
[87407.770127] usb 1-1.2: USB disconnect, device number 31
[87407.772400] cdc_acm 1-1.2:1.0: failed to set dtr/rts
[87407.951541] usb 1-1.2: new full-speed USB device number 32 using ehci-pci
[87408.039875] usb 1-1.2: New USB device found, idVendor=16d0, idProduct=07f1
[87408.039882] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87408.039886] usb 1-1.2: Product: RCT Bootloader
[87408.039889] usb 1-1.2: Manufacturer: Autosport Labs
[87408.039891] usb 1-1.2: SerialNumber: 205D31644333
[87408.040722] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device

and loader succeeds.

Bootloader does not function correctly on Mac

Receiving the following error consistently on OSX:

[stieg@Penguin firmware]$ sudo asl_f4_loader -f stm32_base/main.ihex
Place your device into bootloader mode and then press any key
Searching for an active bootloader
Unable to locate an active bootloader
Usage: asl_f4_loader [options]

Options:
  -h, --help            show this help message and exit
  -f INPUT_FILENAME, --filename=INPUT_FILENAME
                        Filename of .ihex file to process
  -p SER_PORT, --port=SER_PORT
                        (optional)path to serial port we're talking on ex:
                        /dev/ttyACM0
  -v VERBOSE, --verbose=VERBOSE
                        turn on verbose debugging
[stieg@Penguin firmware]$ sudo asl_f4_loader -f stm32_base/main.ihex
Place your device into bootloader mode and then press any key
Searching for an active bootloader
Found bootloader on: /dev/cu.usbmodem1421
Updating firmware...
[**************************************************] 100%

Verifying firmware
Traceback (most recent call last):
  File "/usr/local/bin/asl_f4_loader", line 9, in <module>
    load_entry_point('asl-f4-loader==0.0.6', 'console_scripts', 'asl_f4_loader')()
  File "build/bdist.macosx-10.10-intel/egg/asl_f4_loader/fw_update.py", line 246, in main
  File "build/bdist.macosx-10.10-intel/egg/asl_f4_loader/fw_update.py", line 199, in update_firmware
Exception: Error validating flash on device. Updgrade failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.