cancel
Showing results for 
Search instead for 
Did you mean: 

Read Access to flash beyond address 0x10000

DNeum.1
Associate II

Hello,

I try to read from user flash. Everything is fine until I try to read from address beyond 0x10000. Then I get random values. I use SDCC (3.8.0 and 4.1.0, the behaviour is the same). My device is STM8AF5288 which has 64 KB of flash memory. A program which is located at the flash and occupies it beyond address 0x10000 runs fine (compiled with memory model large), but reading the flash using the StandardPeripheralLibrary function FLASH_ReadByte() returns random values.

A similar question is already here:

https://community.st.com/s/question/0D50X00009XkWUJ/i-am-using-the-stm8al3188-and-am-unable-to-read-or-write-flash-beyond-32k-even-though-the-device-has-64k-flash-this-occurs-at-address-0x10000-flash-starts-at-address-0x8000-making-it-exactly-halfway-i-am-using-iar

using IAR compiler and other STM8 device, but it was closed without solution.

If I look at generated asm code, I see:

        ldw     x, (0x08, sp)
        ld      a, (x)
        ld      (0x01, sp), a

generated for it. I would have expected ldf instruction instead of ldw instruction here, but I am not sure.

0 REPLIES 0