This article explains by example how to manage memory sections.
A segment is a piece of code in memory space. We can manage segments collecting them at classes. For example a segment may be stored in flash memory but the execution address may be set in RAM. It is important for you to have a look at some Keil links:
IMPORTANT KEIL LINKS TO READ:
SEGMENTS CLASSES SROM APNT 120 APNT 121 APNT 122 APNT 129
APNT 138 IMPORTANT!!!
As an example of segment management we will give a solution of the example 4 of the article 10.We give two projects: one in the folder MEMORY;;; and the other in the folder MEMORY OK!
Take them.
At both projects we added a separate .C file, the TEXT2.C file that includes the string
char far *string4 ="12345" . So, we have a clear segment ,the ?FC?TEXT2 segment that belongs to the FCONST class and we write:
?FC?TEXT2 %FCONST
Now in MEMORY;;; project this segment is stored in flash and is executed from flash , but in
MEMORY OK! project the same segment is stored in flash but it is executed in RAM.
Important: watch the R.M66 map file as a text file.
see the story!
Exercise 1: Repeat the projects using the original string of the example 4 that is in TEXT2.C file.
Exercise 2: Give a solution of the example 4 using strcpy() function. |