rust-embedded / cortex-m-quickstart

Template to develop bare metal applications for Cortex-M microcontrollers
791 stars 164 forks source link

memory.x contains incorrect FLASH : ORIGIN value #55

Closed Erich-McMillan closed 5 years ago

Erich-McMillan commented 5 years ago

MEMORY { / NOTE 1 K = 1 KiBi = 1024 bytes / / TODO Adjust these memory regions to match your device memory layout / / These values correspond to the LM3S6965, one of the few devices QEMU can emulate / FLASH : ORIGIN = 0x00000000, LENGTH = 256K <- Value in source code RAM : ORIGIN = 0x20000000, LENGTH = 40K }

but had to change to

MEMORY { / NOTE 1 K = 1 KiBi = 1024 bytes / / TODO Adjust these memory regions to match your device memory layout / / These values correspond to the LM3S6965, one of the few devices QEMU can emulate / FLASH : ORIGIN = 0x08000000, LENGTH = 256K RAM : ORIGIN = 0x20000000, LENGTH = 40K }

then I was able to load the code onto the microcontroller.

Using Rev C+ of the STM32f3xDiscovery board, but that shouldn't be an issue.

therealprof commented 5 years ago

@wolfgangam Please note the comment just above the line you've modified. This file is supposed to be adjusted to the MCU you're using and the values are correct for a different MCU.

Erich-McMillan commented 5 years ago

True, but because the README uses STM32 board the defaults in the memory.x should correspond, especially since the default RAM : ORIGIN and LENGTH are set to this board's specific RAM settings.

therealprof commented 5 years ago

@wolfgangam Actually the README specifically tells you to adjust the file to your needs using the STM32F3DISCOVERY as an example. To be honest I'd have the file contain invalid data so any attempt to compile the file without modification will fail, since this is a step that should never be skipped.