I use a DIP module with an C164 CI.
When I want to add some code and some variables in my excisting program, it does not work anymore. It must be due to the memory mapping and the linker file which are not right configured.
here is the linker: (in monitor mode)
SECTIONS(?C_STARTUP_CODE%ICODE (0x01000), ?C_INITSEC (0x01150))
CLASSES(ICODE (0x000200-0x003FFF) , FCODE (0x000200-0x003FFF),
NCONST (0x000200-0x003FFF) , FCONST (0x000200-0x003FFF),
NDATA (0x060000-0x061FFF) , NDATA0 (0x060000-0x061FFF),
FDATA (0x060000-0x061FFF) , FDATA0 (0x060000-0x061FFF),
HDATA (0x060000-0x061FFF) , HDATA0 (0x060000-0x061FFF),
XDATA (0x060000-0x061FFF) , XDATA0 (0x060000-0x061FFF))
You need to have two separate projects; one for UV debugging in RAM and another for the final output. They have all the same files but the memory maps, compiler flags, defines and linker settings can be different between them. Once you get the debugging one working, create a new target (check the copy project settings checkbox). Now you can change the external target memory in the target tab and check the memory map in the linker/locater tab. You will notice that the settings you gave show all the Data and Code in locations that don't have any memory.
I've found that creating a formal memory layout on paper for the project with locations shown for all related projects is very helpful. I use it for sorting out the chip memory layouts ('167 vs. '168...) and project layouts (UV debugging, programming updates, running, ...). If you write me I can send you a word version of one.
So you mean that I should use as external memory
I have already do that and it does work either.
Futhermore I have done smaller program (just sending a CAN message fro exemple) and this mapping work.
Do you know exactly what happens?
As I said, all my work has been with the '167 & '168 so some of the following may not apply to the '164.
What is the setup on your target board:
RAM size & chip selection?
ROM size & chip selection?
Internal RAM size & location?
Is there enough RAM to hold the target code, data areas & monitor code/data during debugging?
Any time you modify the memory map for the target, you must modify the memory map for the monitor and then rebuild it. Otherwise the monitor loads the code/data in one location, then the target remaps the memory when run, often causing a crash.
You must have ROM at 0x00'0000 for the vector table unless you have relocated the table.
Will all your data fit into internal RAM? It's faster than external for data but may be much slower for code.
You really need to stop and do a map of the desired memory map for the final target. Then try to map the RAM into RAM and ROM areas for the debugging target as closly to this as possible (it cuts confusion). Then change the 'External Memory' to match and check the 'L166 Locate' settings.
"You need to have two separate projects; one for UV debugging in RAM and another for the final output"
Unfortunately, uVision doesn't support a structure where the only difference is that one target is, for example, running from RAM, while another runs from ROM.
In uVision, Targets are completely independent - there is no way to specify a common subset of Target options.
This is a pain! :-(
We describe how to generate targets for Monitor and Flash target under:
It is not that easy, since the hardware typcially requires two different STARTUP file configurations.
View all questions in Keil forum