When debugging can, I found a bug in Zhou licong's startup code of the lpc2100. I hope you can avoid it.
Previously, we used the lpc2214 and lpc2210 chips for the first time. I thought that the startup code can be used in a general sense, and I found that I always ran into the data suspension interruption when the program was running. it took a long time to find out that the problem was caused by the distributed file loading.
Find the mem_c.scf or mem_a.scf file (the content of the two files is the same). Its original code is as follows:
Rom_load 0x00000000
{
Rom_exec 0x00000000
{
Startup. O (vectors, + first)
* (+ RO)
}
Iram 0x40000000
{
Startup. O (mystacks)
* (+ RW, + zi)
}
Heap + 0 uninit
{
Startup. O (HEAP)
}
Stacks 0x40004000 uninit
{
Startup. O (stacks)
}
}
Heap locates the bottom of the stack, and the bottom of the stack is located above Zi. Therefore, "+ 0" is used, and heap will increase from this address.
Stacks locates the top of the stack, which is at the top of the memory that can be used as storage. Stacks drops from the top address of the stack.
It can be seen that from 0x40000000 to 0x40004000 is 16kb, but the lpc2109 only has 8 K in-chip RAM. this is why the program is interrupted. after changing 0x40004000 to 0x40002000, the program runs normally. in addition, if you want to perform one-step debugging in Ram, modify the settings in mem_ B .scf accordingly. the method is the same as above.