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.
Subject says it all. I want to place some tag into flash and than compare it with the data in my SRAM. I know that it is simple but it is hard to start. Please advise. Thanks.
How is a type cast making it more complex?
How is a duplication of a string into RAM _not_ making it more complex?
How is understanding the meaning of the "const" keyword not relevant to learning new tools?
The GLCD function may be 100% totally irrelevant. But anyone who wants to store a string in flash are likely to want to use that string without modifying it. So that someone are then doing well realizing that a copy into RAM is the wrong solution when a const/non-const conflict is caused by the "const" keyword not being used where it should have been used.
Next thing - Keils documentation aren't part of any shame here. It isn't up to Keils documentation to cover basic knowledge of the C programming language. If I sell a stereo, I should supply a manual how to connect the cables to it and how to operate it - I shouldn't have to write a manual on how to decide what music to like. Or how to understand the difference between opera and rock music.
In the end, the addition of a const keyword to that GLCD function is very much in line with what the OP have to consider doing when writing own code, if the OP do want to make use of write-protected arrays stored in flash.
The OP did say "please advice". And the advice is that the data must be copied into RAM if it is going to be modified. It can be used directly where it is, if it shouldn't be modified. But then the OP need to make sure that the code is "const"-correct. Either by making sure every pointer really have the correct type. Or by confusing the code by adding type casts.
So in the end - the answers given are exactly in line with what is requested. The problem is that the OP have assumed that the answers given should sound differently. But why give wrong answers just to make the OP happy?
When the OP have a specific case where copying of data from flash into RAM is meaningful, then - and first then - would it be meaningful to discuss such copying. But on the other hand, such copying would still be a trivial operation since the ARM chip don't care if the source is in flash or in RAM. It only cares that the source is readable and that the target allows writes. So standard C applies with zero embedded-specific or Keil-specific magic.
And shouted a mute man to a deaf one...
Der Mohr hat seine Schuldigkeit getan; der Mohrkann gehen