JLink uploading to incorrect address

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?

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

That should do it. Thanks.

Resolved in Allow to configure upload offset address using `board_upload.offset_a… · platformio/platform-ststm32@853208d · GitHub

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 ST STM32 — PlatformIO latest documentation

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