PlatformIO Community

JLink uploading to incorrect address


#1

When I upload my firmware using JLink it runs successfully but it flashes it to address 0x00 instead of 0x08000000. If I look at the generated jlink script file (upload.jlink) I see:

h
loadbin .pioenvs/foo/firmware.bin,0x0
r

This looks OK but I would expect the load address to be 0x08000000 not 0x0

My platformio.ini has the following

debug_tool = jlink
upload_protocol = jlink

I am using a custom board and I have the following defined in my board’s JSON file.

...
	"name": "REMRAM_V1",
	"upload": {
	  "maximum_ram_size": 524288,
	  "maximum_size": 2097152,
	  "protocol": "jlink",
	  "protocols": [
		"jlink"
	  ]
	},
...

How do I pass in the address 0x08000000 to JLink?


#2

Here is a good example how to override default uploader
https://docs.platformio.org/en/latest/plus/debug-tools/custom.html#j-link-as-debugger-and-uploader


#3

That should do it. Thanks.


#4

Resolved in https://github.com/platformio/platform-ststm32/commit/853208d1705f6dded8bf539526105c929b6580e9

You can override offset address in platformio.ini using board_upload.offset_addres option. Also, default address for ST STM32 was set to 0x08000000.

Please re-test with the latest upstream version https://docs.platformio.org/en/latest/platforms/ststm32.html#upstream


#5

Even better. I’ll test in a few days when back at computer. Thanks.