cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F10x memory remap

redkofka
Associate II
Posted on June 18, 2012 at 07:17

Hi i have stm32f100rb mcu and i need to have custom memory map on it

it can be a virtual memory which looks like from outside like

or something like memory remap

i was never doing somethink like that and i dont even know if its possible....

for example - program running on pc want to read ram from

0x00000 to 0x0FFFF - but sram on the stm32f is from 0x1FFFFFFF to 0x3FFFFFFF

so its there some way to have (0x00000-0x0FFFF)Block of memory on procesor sram address...

the device must have this memory map

0x0 - 0x0FFFF - SRAM

0x10000-0x7FFFF - eeprom - external

0x80000 -0xEFEEE - CODE

0xF0000 - 0xFFFFF flash storage

thanks for yours answers ....

and have a nice day ...

#stm32f #map #memory #remapping
6 REPLIES 6
Posted on June 18, 2012 at 14:13

Basically, No.

How does the PC specify the address is wants to read, and why can't you translate that?

If it is a request that the STM32 processes, just add some conversion code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
redkofka
Associate II
Posted on June 18, 2012 at 14:36

pc send me a packet where is address Lo and adress Hi and i must send data from this part of memory or write in memory ....

soooo when i use block of ram 0x20000000-0x2000FFFF and when i will read from or write in a will be showing that is 0x00000-0x0FFFF it will be no problem ....

for example monitoring program on PC want to read memory 0x00000-0x00001 - in fact i will be send what i have in processor at adress 0x20000000-0x20000001

am i right ?

its sounds quite simply.....

thanks for your answer ...

alok472
Associate II
Posted on June 18, 2012 at 15:12

just a caution, the sram will also contain your code variables. If the PC just reads, then it is fine. If you want to try Write-Read for verification, you may corrupt your code variables.

In addition, do take care that if you Read/write on an adderess which does not exist, you may encounter HardFault.

Posted on June 18, 2012 at 19:12

You will probably run into problems if you can't tailor your PC application to the hardware it's attached too. It would clearly need to understand what code it is sending to an STM32 part, but you don't provide a sufficiently through context to fully understand the problem.

Simple address translation on the STM32 side could look something like this :

if ((Address >= 0x00000) && (Address <= 0x0FFFF))
STM32Address = 0x20000000 + (Address - 0x00000); // RAM conversion
if ((Address >= 0xF0000) && (Address <= 0xFFFFF))
STM32Address = 0x08000000 + (Address - 0xF0000); // FLASH conversion

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
redkofka
Associate II
Posted on June 26, 2012 at 08:07

Thanks a lot ...

i use data packets to comunicate with pc and on 4. position of packet pc send me in upper byte segment part of memory and in lower byte lenght of memory block - in other positions of packet is data....

for example packet[4]=0x05 packet[5]=0x10 packet[6]=0x00  so i should start read on adress 0x01000 - 0x01005 but physicly i read from adress 0x20000000+0x01000 to 0x20000000+0x01005

if packet[4]=0xF5 packet[5]=0x10 packet[6]=0x00  so i should start read on adress 0xF1000 - 0xF1005 but physicly i read from adress 0x80000000+(0xF1000 - 0xF0000) to 0x80000000+(0xF1005 - 0xF0000)

and it will be used only for read memory i think and send it for check on pc...

emalund
Associate III
Posted on June 26, 2012 at 15:49

use the 'address' as offset into an array

Erik