Flash access from bootloader fails

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User7989
Level 2
Level 2
I have an XMC4500 hexagon kit (revision AB).

I'm trying to implement a custom bootloader, and have difficulties with the flash access.

My workspace contains three projects.
* Bootstrap
* Bootloader
* Application

I startup the board in normal mode, where the bootstrap is located at the beginning of flash (cached).

The bootloader is already built and linked by the linkerscript to PSRAM. It's binary is referenced by the bootstrap so it can copy the content into PSRAM upon startup. (I didn't find a way to solve this in a single project).
This seems to be working, I can jump into my bootloader, and also further into my Application if needed. So far so good.

But when my bootloader tries to erase a sector (using the FLASH002-app) will it always end up with the SQER bit set in FSR.

The interesting part of this is that I can successfully run my bootloader in debugmode, (In that case is not the bootstrap needed).

Have been looking at the Write/Read protections, and also tried to disable them without any luck.

Have read out all registers what i can find interesting and printed them out, but they don't give me any clue of whats wrong
PROCNO0: 0
PROCNO1: 0
PROCNO2: 0
FCON: 3
FSR: 0
CONTROL: 4 (Privileged mode is set)

I fully understand that it isn't easy to help me with such a specific problem. But maybe someone got an idea of what's going on?
0 Likes
1 Reply
User7989
Level 2
Level 2
There was actually already a thread with a identical problem (missed it earlier):
http://www.infineonforums.com/threads/1118-Problem-using-FLASH002-App?highlight=flash002

So the problem was solved by:

#define M32(adr) (*((volatile uint32_t *) (adr)))

This should be updated to the next release of FLASH002!
0 Likes