cancel
Showing results for 
Search instead for 
Did you mean: 

Write to Flash with Keil Simulator

yonkahlon
Associate II
Posted on February 26, 2016 at 12:16

Hi,

I'm trying to use Keil simulator to test my application. I'm writing some data to flash memory, using the HAL drivers generated by cubeMX. After the write operation, the flash memory doesn't change.

I'm just wondering if it is possible to simulate this?

Thanks,

#flash #stm32f #rewrite #keil-simulator
4 REPLIES 4
Posted on February 26, 2016 at 12:47

Assume the simulator is very poor at replicating gate level functionality and peripheral emulation.

You should test on real hardware without a debugger attached.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
yonkahlon
Associate II
Posted on February 26, 2016 at 13:02

Thanks for getting back to me.

The idea is to write unit tests that ideally run on a simulator

It feels like there must be a way to modify the data in ROM if its simply a simulator...

If I try to set the value of a register at a ROM address, nothing happens either - so I'm assuming it's to do with Keil's simulator that doesn't allow those registers to be edited?

Posted on February 26, 2016 at 14:18

When there were a few dozen simple ARM chips Keil/RealView had a good simulator for them, now there a thousands, with complex peripherals, and the problem is unmanageable.

Also back then test board run hundreds of dollars, today about ten dollars.

If you are a fully paid up Keil customer you could perhaps ask them for specific support, or allow you to build a peripheral emulation layer. These things wouldn't be gate level emulations, which would be a whole different level of cost, but rather someone's interpretation of the reference manual, mixed with some hardware validation and design skills. I generally think of this as comparing two interpretations of documentation, rather than comparing against reality. I see diminishing value there, and effort would be better applied to rigorous static analysis.

You could also build your own test framework.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
yonkahlon
Associate II
Posted on February 29, 2016 at 06:48

Yeah, I agree. But I simply want to write to memory and see that the correct things are written. I'm writing a double buffering settings module and would like to unit test using our unit testing platform which is based on the simulator

I did manage to get around this. I noticed that I can edit the section of flash below the application. It pretty much works like RAM memory - which isn't ideal, but is good enough for now.

Anyways, thanks for your insights.