rusefi/firmware/bootloader
Andrei 48ab85d636 cypress_usb_print_test
cypress trying to start TS

TS connect success!

blind code ready for GPT,ADC,SPI

SPI basic test works on 9201 and 8860

Timer is working

ADC fix?

Flash kinda works... in debug mode

DRV8860 driver works! ADC partially works! Flash works!

adc 1 channel works

fix for ADC channels>16 & fastADC problem

ADC works!

EXTINT first attempt... no IRQ?

Led3 blinks

EXTINT works!

trigger_adc EXTINT part works!

trigger_ADC analog preparations... not working yet

ADC now 100% works! But fast is NOT 10kHz!

Fast ADC works... Almost - strange adcToVoltage values...

fastADC working only first 22secs + fatal error after 33secs + USB not connecting

fastADC is working again, problems solved!

triggerADC - It works! (Still no timeshift compensation)

Forgot drv8860

ADC->EXTI trigger switching works! (but not seamlessly)

ADC->EXTI trigger switching now seamless? Needs more testing

ADC->EXTI trigger switching works!

trigger+RPM works but still trgerrors...

trying to impl. adaptive threshold... No luck so far :(

trigger detector almost works - trgerr=0 but no rpm<200?

triggerADC finally works!!! For now...

backup_ram for cypress

main_relay, stepper

better main_relay+stepper

USB VBus detection

CAN driver draft

CAN update

CAN interrupts fix

update

update

update

update

update

main.cpp clean-up

rusefi.ini clean-up

compilation fix

compilation fix

compilation fix
2020-09-11 18:21:53 +03:00
..
prometheus naming convention 2019-03-29 11:24:25 -04:00
src The Big Refactoring of 2019: folder structure #723 2019-12-04 00:04:27 -05:00
!clean_bootloader.bat Firmware Update via UART and/or USB #398 2019-03-28 07:38:15 -04:00
!compile_bootloader.bat cypress_usb_print_test 2020-09-11 18:21:53 +03:00
!compile_bootloader_405.bat cypress_usb_print_test 2020-09-11 18:21:53 +03:00
!compile_bootloader_469.bat Remove chibios trace flag (#1037) 2019-12-02 19:11:07 -05:00
!compile_bootloader_discovery407.bat Remove chibios trace flag (#1037) 2019-12-02 19:11:07 -05:00
STMFlashLoader_all_screenshots.png
bootloader.h
bootloader.mk Refactoring 2017-06-04 22:01:40 +03:00
bootloader_generated.hxx Refactoring 2017-06-04 22:01:40 +03:00
bootloader_storage.c defined(__DOXYGEN__) ? fix #748 2019-04-12 22:10:57 -04:00
readme.md MD is pretty much same thing as TXT 2019-03-27 20:40:46 -04:00

readme.md

*** User Manual ***

To start the bootloader updater:

  • Turn off your rusEFI ECU board, and connect UART to PC.
  • Download "FLASHER-STM32" here: http://www.st.com/en/development-tools/flasher-stm32.html
  • Run "STMFlashLoader Demo", set COM-port parameters (the same as in TunerStudio).
  • Press the "Next" button.
  • Turn on the ECU board.
  • If the connection is successful, the next page of STMFlashLoader appears immediately. Press "Next" button again and follow the instructions.
  • You can use:
    • Upload from device (Flash Read) command;
    • Download to device (Flash Write) command;
    • Erase->Selection command (only Sector erase is currently supported, not Full Erase!).

To update the firmware:

  • choose "Download to device" mode;
  • select the firmware file (rusefi.hex). Note! Use only recent firmware builds with bootloader support!
  • you may select "verify" option to check
  • you may select "Jump to the user program" to automatically run the main firmware after the update.

image

!!! Note that the bootloader can update only the main firmware, but not itself !!!

Use this code on your own risk!

*** Developers Section ***

How it works, in two words:

  • The bootloader requires a separate makefile because it's a separate binary executable with its own project settings and fileset.
  • Start firmware/bootloader/compile_bootloader.bat to compile the bootloader code. Use it only if bootloader modification is required.
  • The compiled bootloader code is stored in bootloader/bootloader_generated.hxx and it can be included into the main firmware (build/rusefi.hex) if the bootloader support is enabled.
  • The bootloader support is disabled by default (USE_BOOTLOADER=no). You can enable it by adding "USE_BOOTLOADER=yes" to Makefile or "SET USE_BOOTLOADER=yes" to your Windows compile batch-file.
  • When USE_BOOTLOADER=yes, a special version of linker script is used: STM32F407xG_CCM_bootloader.ld. It shifts 'flash' memory address to 32kb (0x08008000), and clears a space for bootloader at the very beginning of the flash memory. It also adds section ".bl" for the bootloader code.
  • The file bootloader_storage.c used to include the bootloader code into the firmware (using '.bl' section).
  • In result, there are two binary executables combined in one firmware: the bootloader starts first, and the main firmware start afterwards.
  • All those can be overridden by board configs and makefiles - that's exactly how it's been compiled for Prometheus board.

The bootloader executable works as follows:

  • Init ChibiOS and UART/Serial driver using tunerstudio_io code;
  • Create a thread to listen to UART (thBootloaderSerial), using dfuStartLoop();
  • The PC 'stm32-flasher' software sends its request byte only once, so we don't wait for it - the bootloader sends an answer as soon as it starts (both the request & answer bytes are known consts);
  • If the next command doesn't come immediately (<100 ms), we abort the bootloader dfu loop and run the application code - calling dfuJumpToApp() in main().
  • Otherwise, if at least one command is received, we stay in the bootloader mode and process commands.