Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootloader breaks when flashing binaries > 80000 Bytes #67

Open
macbef opened this issue Jan 10, 2024 · 0 comments
Open

Bootloader breaks when flashing binaries > 80000 Bytes #67

macbef opened this issue Jan 10, 2024 · 0 comments

Comments

@macbef
Copy link

macbef commented Jan 10, 2024

Hello,
I just created a custom device with a STM32F103RC controller.
According to the docs here I flashed the highDensity bootloader and I am able to upload binaries.
So far so good.
Problem is, if I use a binary with a size larger than 80000bytes the bootloader breaks.
(meaning after re-connecting USB the USB port does not enumerate and the code is not running. Only way to get the controller back to life is reflashing the bootloader).

In short, if the last line of the upload message is . 77824 Bytes, everything is ok.
If the last line is . 8xxxx Bytes, the BL breaks.

I'm using platformIO with this platformio.ini:

board=genericSTM32F103RC
board_build.core = ststm32
framework = arduino
monitor_speed = 115200
upload_speed = 19200
upload_protocol = hid
build_flags = 
	-D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
	-D ENABLE_HWSERIAL1
	-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
	-D USBCON

I have the feeling that this is some kind of linker problem. Because when I use DFU as upload method (with the DFU bootloader installed), I can easily use larger binaries.
Maybe the reserved RAM for the interrupt lines get overwritten?

Not sure if this is a HID bootloader issue or a linker issue within platformio. But I thought maybe someone has seen this behaviour as well?

Edit:
The building environment looks the same when changing the upload protocol between hid and dfu (apart from the LD_FLASH_OFFSET=0x800 vs 0x2000).

pio run -t envdump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant