This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I was looking at the memory map of the 379D, and I have several questions
1) where is the LIFO stack of the Programm Counter (I mean the stack where is saved the current PC value before a function call)
2) where is the LIFO stack of the the Stack Pointer (I mean the stack where is saved the current SP value before a function call)
3) I wondered where in the memory are placed the Special Function Register (sorry, Microchip term). I mean the peripheral Register. I expected that they all were placed in a same block, but when looking at the data sheet, it seems that they are scattered in the memory
How the linker does to not use these parts of memory for the user ?
4) Finally, I cannot understand this memory map:
How to link it with the easier understable table seen in the datasheet ?
Thank you for your help
Hi,
For 1. &2.
The stack size needs to be allocated while the program is compiled. This can be done by using the compiler option --stack and then in the linker command file you choose which RAM section it should be allocated to. For e,g:
.stack : > RAMM1
When a function is called , the return address gets stored in the register RPC (Return program counter) while the parameters to the functions are stored in the registers or stack.
3. The address for each peripheral are mentioned in the table. It specifes the start and end address for each of the peripherals
4. You can refer the memory map table , the RAM is split into multiple regions and the start and end address for each are specified in this table. The picture depicts where in the memory map the different memories are mapped.
Best Regards
Siddharth
Hello,
For 1&2, I don't mean the stack pointed by SP. I mean the stack where is stocked the SP. The SP Register points to the first free address of the stack section. When a function is called, it points further (since space for local variables is allocated). When returning, the previous value of SP has to be loaded in the register. So, they are a LIFO stack for this register I think. That's the place of this LIFO I want to know
3. I saw this reading the table. I just wonder why the register are not in a same block
4. Sorry, I still don't understand the picture (2 tables for the same addresses, one for data and one for Programm). It is not important for me ...
If someone can answer to the questions 1 & 2, I ll really appreciate.
Thank you, in advance
edit: looking at the disassembly code, there is no stack for SP (the compiler adds a number in the entry of a function, and substract the same number at its exit). So my question only concern the LIFO for RPC
edit (again). Sorry, I ve just read the details of LRETR instruction. the RPC stack is stored into the same stach than local variables. My fault. I close the issue