We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello everyone: I have a problem.
My software in on-chip flash is very small,so I define the memory model in keil to "small" type.
But I have to save some datum in on-chip flash. I place the datum in the adress 0xC1F000,and define the section is "LARGE".When I build the code,it is warning "incompatible memory model ".When I run the code ,keil prompts "access violation".
What shall I do ? Thank you !
I am not sure why you are getting an access violation.
In my opinion you should still use the small memory model. You just need to use qualifiers for your data and functions. By using a small memory model you default to near data and near functions. With a large memory model you default to far data and far functions.
So for your data located at memory range of 0xC1F000-0xC1FFFF you could you a far, huge or xhuge type.
Example: #pragma RENAMECLASS (FCONST=MYDATUM) const int far myfarconstdata = 0x1234;
You would need to create a user class for this to be located at your desired memory address. See help for more information.
Thank you!
I want to tell everyone a detail should be paid attention to:the "far" variable reference should be edit to "far".Keil will not warning the error,and it will still access violation .