cancel
Showing results for 
Search instead for 
Did you mean: 

The last 2 bytes of FLASH cant be written?

Tobe
Senior III

I just was testing the bootloader, when it did not respond after writing the flash. Upon inspecting the memory, i found the last 2 bytes have not been written? (i guess the uC went to hard fault or something)

It should not be this way?

1 ACCEPTED SOLUTION

Accepted Solutions

Yes i should have shown more. I try to be better next time.

I have fixed the issue. I cant believe, that i have found again not just one error.

First, i had a catch implemented, that would not let it come to a wrong memory acces, but this had an error so it came too early.

Second, feof() (C on windows) does not tell you, when you just read the last byte, and have reached the EOF. omfg

And while dealing with this issue, i had several BSOD's. What a nice time i have....

View solution in original post

8 REPLIES 8

 

> I just was testing the bootloader,

What bootloader?

How do you test it, exactly?

JW

My bootloader. I write a file to it, that fills the remaining flash. If i write the FLASH only until 1FFF5 it seems to be fine.

Hi @Tobe ,

you need to check how your programming algorithm is implemented if writing 64-bit at a time or  a row  of 32 double words . Also if you are reading next bytes or words and in particular while cache and prefetch is active of the flash as it may read an extra byte ( not existing ) by cache / Prefetch line size even not wanted by CPU as speculation . And so hitting a not existing memory to read .

Hope it helps you .

STOne-32

Two Bytes or Two Words.

The image doesn't communicate HOW you're failing to do this.

Perhaps have your Error Handler and Hard Fault Handler communicate actionable data about what's failing and what the MCU is objecting too.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

If i write after 0x0801FFF5, the my uC stopps working. This would be a hard fault i gues??

It does not match the memory range in the datasheet.

Two words... my bad.

 

It failed when writing the last 2 words that you can see on the picture (FFF0 - FFF7) which were written anyway). When i write the same, but without the last two bytes, it works without error.

Ok, so you've described the nature of the failure multiple times, but not presented any code that illustrates you're failed approach. If you think there's a Hard Fault, that's not hard to confirm or not..

You'd get a Hard Fault if you attempt to read or write beyond the scope of the memory.

Perhaps instrument your code, so it provides output about what's happening, and how it's writing 64-bit aligned double words to the memory.

Your presentation of this needs to get significantly better, or my imagination and telekinesis skills need to get fantastically good..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes i should have shown more. I try to be better next time.

I have fixed the issue. I cant believe, that i have found again not just one error.

First, i had a catch implemented, that would not let it come to a wrong memory acces, but this had an error so it came too early.

Second, feof() (C on windows) does not tell you, when you just read the last byte, and have reached the EOF. omfg

And while dealing with this issue, i had several BSOD's. What a nice time i have....