Below are two custom made microcontrollers. The only difference between this is memory size.

enter image description here

My question:

  1. Can someone tell me what is their start address and end address? Like, for the first one - Flash size , it is like 0xFF 0000 - 0xFF FFFF. But for the second one, it is from 0xFE 0000 - 0xFF FFFF.

Can someone tell me the address range for the above two cases as I was not able to understand it.

My basic doubt came like, if we are choosing a microcontroller with a higher memory, the new higher memory microcontroller will start with the same address as the old one, but will have extended memory location, meaning, the end address location will be higher. Like, the RAM size and EEPROM size, both microcontrollers have the same starting address but they have different ending address. I thought it should and will be like this. But why is it different for Flash size?

Can someone clear my query.

  • 1
    \$\begingroup\$ It depends on many thins. Different MCUs can work differently if they want to. From which address the MCU starts program execution, or fetches the vector for program start? If at the end of memory, this might explain it. \$\endgroup\$
    – Justme
    Commented Nov 10, 2021 at 12:45
  • 2
    \$\begingroup\$ To be able to boot, the initialization vectors must be in flash, usually it's at address zero, or at the maximum address, in this case 0xFFFFFF. Since the flash sits at high addresses, it's probably the latter, and it will be word aligned, so 0xFFFFFC if 32 bit aligned. \$\endgroup\$
    – bobflux
    Commented Nov 10, 2021 at 12:47
  • \$\begingroup\$ There is no general rule to say all microcontroller with on-board flash will have the same address space for flash memory. It just happens that your vendor, for a particular reason has chosen an address space that extends to a lower start address for the 128K variants. Many other vendors do not necessarily follow this particular address space. May I ask for which MCU part is your question ? \$\endgroup\$
    – citizen
    Commented Nov 10, 2021 at 13:47
  • \$\begingroup\$ further to this question, it would help adding an MCU part number for those that may have experience with the same MCU etc. Otherwise for the specific reasons the MCU manufacturer chose this address spacing (extending to lower addresses with increasing memory size) I suggest really its a question better posed to the actual MCU manufacturer ... \$\endgroup\$
    – citizen
    Commented Nov 10, 2021 at 13:52
  • \$\begingroup\$ I am still in the beginner level to understand more about this firmware. Could you please explain me what is initialization vector. \$\endgroup\$
    – user220456
    Commented Nov 10, 2021 at 15:16

2 Answers 2


For the larger flash, the start address moves downward.

Like for the RAM and EEPROM, an additional address line is used. In the small variant, this address line is fixed to '0' for RAM and EEPROM, and '1' for Flash, so if the big variant decodes this line, this means that RAM and EEPROM addresses can be bigger (because what was a '0' before can now be '0' or '1'), and for the Flash, the newly valid addresses are smaller (because an '1' can now be '0' or '1'.

  • \$\begingroup\$ Thank you for the answer. but I am unable to understand most part of it. Could you please break it into simpler terms. I'm still a beginner in firmware \$\endgroup\$
    – user220456
    Commented Nov 10, 2021 at 15:17
  • \$\begingroup\$ @Newbie, look at the addresses in binary form. You will see that each address has a number of bits at the beginning that are the same for start and end address, and a number of bits at the end that are '0' for the start address and '1' for the end address. The variable part at the end is how bytes inside that memory are addressed, if you double the size, you need one more bit. \$\endgroup\$ Commented Nov 10, 2021 at 16:27

Every microcontroller project comes with a linker script which in turn corresponds to the memory map. If you wish to take advantage of additional address space by switching to a part with more memory, you will have to change this linker script.

Usually the default option is "I don't care where my variables end up in memory" and then your linker script will look something like (completely made-up pseudo code):

flash exists in 0x00FF0000 - 0x00FFFFF
RAM exists in 0x1000 - 0x1FFF
place .text in flash
place .stack in RAM

The syntax for these linker scripts is very different from tool chain to tool chain, but the contents are always pretty much the same. They declare a number of sections residing at certain physical memory addresses, then relevant part of the data/program is allocated in those sections.

As for the de-facto standard names of various parts generated by a C program, almost every MCU tool chain uses the names of ELF, see this for details: What resides in the different memory types of a microcontroller?

  • \$\begingroup\$ Thank you very much for your answer. I could understand some part of your answer. Let me read and understand the other answer that you have linked and try to come here if I have any further questions. \$\endgroup\$
    – user220456
    Commented Nov 10, 2021 at 15:18
  • \$\begingroup\$ @Newbie Basically just go dig up the linker script of your tool chain and it should be pretty self-explanatory at least as far as addresses go. \$\endgroup\$
    – Lundin
    Commented Nov 10, 2021 at 15:28

Your Answer

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