0
\$\begingroup\$

I am having some confusion regarding the stm32f446xx memory remap feature in the reference manual. The system configuration memory remap is used to change the memory at 0x00000000.

  1. I am having some confusion whether the boot pins will remap the memory at the address or the SYSCFG memory remap register will remap that as shown: enter image description here

By except for FMC do they mean the for FMC at 0x00000000 I have to use these bits otherwise I can use these bits or the boot pins. Am I right?

  1. Also the bootloader cannot be stored in FMC memory NOR/SDRAM so if I set the FMC at that address then how does the bootloader works?
  2. suppose my bootloader pins are pointing to flash and the bits in this register are to FMC then what will be actually mapped into the address 0x00000000 and which memory will come there.
  3. Finally I am not able to understand that if my flash is brought at 0x00000000 then what happens to the actual memory address where the flash was initially located at. Will that portion be skipped then?

Kindly help me solve these confusions.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$
  1. First thing to set straight is that the MCU has no bootloader code on normal startup and no code is run except the code you select to run from some memory by selecting the memory mapping with the boot pins. The system bootloader is executed only if you select it, and if you have a custom bootloader you have written in some memory area, then you can choose to run it with the boot pins as well, if that memory area is selectable via boot pins.

  2. The vaue of SYSCFG register is loaded with the state as set by the boot pins on reset. So technically, it's not the boot pins that affect the mapping, but that is the effect you see. And that is the reason you cannot select FMC with boot pins, if you want to map that you need some code that writes to SYSCFG.

  3. See 1). You can't use the boot and reset pins to instruct the MCU to start executing code from FMC. You can however still map the FMC to address 0 and jump to run code from there, maybe via JTAG or through system bootloader or custom bootloader or just having an application that does it. The MCU just can't be made to do that with boot and reset pins.

  4. See 1). The SYSCFG is loaded from boot pins on system reset. Your code can write SYSCFG to change what is shown at the beginning of memory and it will be what you want instead of the value the MCU booted with.

  5. See 1). Nothing will happen to your flash. The only thing that changes is what memory is also mapped to beginning of memory. Even if the MCU loads initial stack pointer and instruction pointer from beginning of memory, they will come from flash of from wherever your boot pins instructed the MCU to boot from. And usually code compiled to run from flash will reference code addresses in flash, so technically the SYSCFG mapping was simply used to fetch two doublewords and then the code runs without any need to know if something was mapped to beginning of memory and what it was.

\$\endgroup\$
2
  • \$\begingroup\$ So you mean to say that bootloader doesnt essentially start at 0x0000000000?It check the pins and jumps to that adress. \$\endgroup\$
    – kam1212
    Commented Jul 28 at 8:34
  • \$\begingroup\$ @kam1212 I said there is no bootloader. The MCU always starts code at 0 in hardware and the pins define what is mapped to 0 in hardware. Having a bootloader would mean there is some other code that the MCU executes, reads the boot pins and jumps somewhere. No there is no such code. \$\endgroup\$
    – Justme
    Commented Jul 28 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.