Hi, we are currently evaluating MDK6 as our new development platform for recent and future projects.
After successfully building our project and setting up the device family and so on we are finding troubles when flashing the image to the internal flash of the MCU.
Our MCU has an internal flash that is mapped in the range [0x00400000-0x005FFFFFF]. This flash memory is organized as follows:
- 0x00400000-0x0041FFFF: area reserved for the bootloader and configuration variables.
- 0x00420000-0x005FFFF: area for the application.
The bootloader is in charge of making the PC jump eventually to the application address (0x00420000) and it is programmed and built by a completely separate process.
In the current project we want to flash the application in the range 0x00420000-0x005FFFF.
This is the command armdbg executes under the hood after we try to flash:
armdbg --program-only --target="DWJFP0ODRQ5EF" --workspace-folder="/home/jmartin/nuo-awa/Project/MDK-ARM" --image="/home/jmartin/nuo-awa/Project/MDK-ARM/out/SWM0475-NUO_AWA_Board_BYV4/debug/SWM0475-NUO_AWA_Board_BYV4.axf" --probe="CMSIS-DAP" --stop-on-connect=true --port-mode="SWD" --cmsis-pdsc="/home/jmartin/.cache/arm/packs/Microchip/SAME70_DFP/4.5.86/Microchip.SAME70_DFP.pdsc" --cmsis-device-name="ATSAME70N20" --flash-config="algorithm=/home/jmartin/.cache/arm/packs/Microchip/SAME70_DFP/4.5.86/same70a/keil/flash/ATSAME7x_1024.FLM,region_start=0x00400000,region_size=0x00200000,ram_start=0x20400000,ram_size=0x00060000,erase_method=SECTORS,verify=true" --flash-config="algorithm=/home/jmartin/.cache/arm/packs/Microchip/SAME70_DFP/4.5.86/same70a/keil/flash/ATSAME7x_GPNVM.FLM,region_start=0x1FFFFFF0,region_size=0x00000010,ram_start=0x20400000,ram_size=0x00060000,erase_method=SECTORS,verify=true,ignore"
And this is the output of the command:
[server] Starting debug server[server] Waiting for debug server to start accepting connections[server] Debug server started successfullyStopping running target Cortex-M7 on connectionConnected to running target Cortex-M7Execution stopped in Privileged Thread mode at 0x004415F80x004415F8 B {pc} ; 0x4415f8Mapping segment 0x00420000 ~ 0x0046A468 (size 0x4A468)Starting flash programming operation: Programming 304232 bytes to 0x00420000Flash Progress: 0% (Erasing)Flash Progress: 21% (Erased 163840 bytes)Flash Progress: 40% (Erased 311296 bytes)Flash Progress: 40% (Erasing completed)Flash Progress: 40% (Writing)Flash Progress: 41% (Wrote 10240 bytes)Flash Progress: 43% (Wrote 20480 bytes)Flash Progress: 44% (Wrote 30720 bytes)Flash Progress: 46% (Wrote 40960 bytes)Flash Progress: 47% (Wrote 51200 bytes)Flash Progress: 49% (Wrote 61440 bytes)Flash Progress: 50% (Wrote 71680 bytes)Flash Progress: 52% (Wrote 81920 bytes)Flash Progress: 53% (Wrote 92160 bytes)Flash Progress: 55% (Wrote 102400 bytes)Flash Progress: 56% (Wrote 112640 bytes)Flash Progress: 58% (Wrote 122880 bytes)Flash Progress: 59% (Wrote 133120 bytes)Flash Progress: 61% (Wrote 143360 bytes)Flash Progress: 62% (Wrote 153600 bytes)Flash Progress: 64% (Wrote 163840 bytes)Flash Progress: 65% (Wrote 174080 bytes)Flash Progress: 67% (Wrote 184320 bytes)Flash Progress: 68% (Wrote 194560 bytes)Flash Progress: 70% (Wrote 204800 bytes)Flash Progress: 71% (Wrote 215040 bytes)Flash Progress: 73% (Wrote 225280 bytes)Flash Progress: 74% (Wrote 235520 bytes)Flash Progress: 76% (Wrote 245760 bytes)Flash Progress: 77% (Wrote 256000 bytes)Flash Progress: 79% (Wrote 266240 bytes)Flash Progress: 80% (Wrote 276480 bytes)Flash Progress: 82% (Wrote 286720 bytes)Flash Progress: 83% (Wrote 296960 bytes)Flash Progress: 85% (Wrote 304232 bytes)Flash Progress: 85% (Writing completed)Flash Progress: 85% (Verifying)Flash Progress: 95% (Verifying failed: Verify failed at address: 0x00420000)Flash Progress: 95% (Programming failed)Disconnected from stopped target Cortex-M7ERROR(?): Flash programming failed: Verify failed at address: 0x00420000[server] Debug server shutdown application[server] Debug server shut down attempted[server] Done
The .map file generated when compiling shows that main is effectively at 0x00420000 and there are no symbols with a memory address lower than that and the output of the command confirms it should be writing to 0x0420000.
However, if I perform a memory dump after flashing I can confirm that, contrary to what is reported, it starts writing at address 0x00400000 which is the start of the flash.
Is this a known bug? What do I need to do to tell armdbg to start writing at 0x00420000 instead?
Hello,
Sorry for not getting back to you earlier.
We will look into this issue and will get back to you as soon as possible.
Thank you.