Hi, folks.
I work with STM32F429ZI and PlatformIO on QtCreator, and i need to upload firmware to specific address like 0x08020000 for example. And I can’t find in docs on platformio which key for upload_flags I can use for it, or how I can modify upload_command for it. Thanks.
The builder scripts in platform-ststm32/main.py at develop · platformio/platform-ststm32 · GitHub respect the upload.offset_address
from the board’s JSON definition file.
Yours is here
Accoring to docs you can also try and add to the platformio.ini
something like
board_build.upload.offset_address = 0x08020000
Use pio run -t upload -v
or “Verbose Upload” to verify that the flasher command contains the correct upload address.
board_build.upload.offset_address = 0x08020000 doesn’t work.
I think that modifying MBED board’s JSON definition file not good idea
Can you give your platformio.ini
and the log of the aforementioned verbose log?
Are you talking mbed-os?
You can also create a folder called boards/
and create a new board definition there. See docs.
I found right solution for me. It is add mbed_app.json to your project root with:
{
"target_overrides": {
"*": {
"target.mbed_app_start" : "0x08020000",
"target.mbed_app_size" : "0x000A0000"
}
}
}
This parameters expand to:
MEMORY
{
FLASH (rx) : ORIGIN = 0x8020000, LENGTH = 0xa0000
...
}
on your .ld script and you don’t need to change upload_flags and upload_command.
Yes, sure.
[platformio]
; Set a path to a cache folder
build_cache_dir = /home/user/Builds/Firmware_mbed/cache
[env:nucleo_f429zi]
platform = ststm32
platform_packages = toolchain-gccarmnoneeabi@>1.80000.0
board = nucleo_f429zi
framework = mbed
build_flags =
-std=gnu++17
-D PIO_FRAMEWORK_MBED_RTOS_PRESENT
-D DEBUG=1
build_unflags = -std=gnu++98
monitor_speed = 9600
monitor_port = /dev/ttyACM0
board_build.upload.offset_address = 0x08020000
;upload_command = $UPLOADER -s /home/xoma/.platformio/packages/tool-openocd/scripts -f board/st_nucleo_f4.cfg -c "program $SOURCE 0x08020000 verify reset; shutdown;"
output:
/usr/local/bin/platformio run -t nobuild -t upload -v...
Processing nucleo_f429zi (platform: ststm32; platform_packages: toolchain-gccarmnoneeabi@>1.80000.0; board: nucleo_f429zi; framework: mbed; build_flags: -std=gnu++17, -D PIO_FRAMEWORK_MBED_RTOS_PRESENT, -D DEBUG=1; build_unflags: -std=gnu++98; monitor_speed: 9600; monitor_port: /dev/ttyACM0; board_build.upload.offset_address: 0x08020000)
--------------------------------------------------------------------------------
<lambda>(["upload"], [".pio/build/nucleo_f429zi/firmware.elf"])
AVAILABLE: blackmagic, jlink, mbed, stlink
CURRENT: upload_protocol = stlink
openocd -d2 -s /home/user/.platformio/packages/tool-openocd/scripts -f board/st_nucleo_f4.cfg -c "program {.pio/build/nucleo_f429zi/firmware.elf} verify reset; shutdown;"
xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:25)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 2000 kHz
Info : STLINK V2J29M18 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.255118
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08001ee0 msp: 0x20030000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
** Programming Started **
Info : device id = 0x20016419
Info : flash size = 2048 kbytes
Info : Dual Bank 2048 kiB STM32F42x/43x/469/479 found
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked`
========================= [SUCCESS] Took 9.53 seconds =========================`
sorry, I mixed up “mbed” and platformio files.
Does mbed_app_size
represent the maximum size of my app code can be?