Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

MaMi_1205306
Level 7
Level 7
500 replies posted 50 solutions authored 25 likes received

Dear Sirs and Madams,

 

We read the stack area and vector table area from map file of PSoC4S.

 

<Stack area>
0x20000800 PROVIDE (__cy_stack, (ORIGIN (ram) + LENGTH (ram))) [! Provide] PROVIDE (__cy_heap_end, (__cy_stack --0x200))

The above code is the location of the stack area、

_cy_stack --Since it says 0x200,

is it correct to recognize that 0x20000600 to 0x200007FF is the stack area?

 

<Vector table>
.ramvectors 0x20000000 0x80. \ CortexM0p \ ARM_GCC_541 \ Debug \ Cm0plusStart.o
0x20000000 CyRam Vectors

The above code is the location of the vvector table area、

Is it correct to recognize that the size from 0x20000000 to 0x80 (up to 0x2000007F) is the area of the vector table?

 

Regards,

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @MaMi_1205306 ,

Yes in the map file, you will get the start addresses and the end addresses of each of the memory sections along with the size they occupy. For example,

DheerajK_81_1-1615831347341.png

 

You can see here that the stack starts at 0x2000_1800 and extends to 0x2000_2000,  with the total size of the stack being 0x800. This region forms the stack area.

Another way to calculate this based on the linker script logic is:
Lets say the SRAM is 4KB (0x2000_0000 - 0x2000_1000). So if the stack size if configured as 0x400, then you can say that the stack region starts from end of the RAM to 0x400 bytes down. i.e 0x2000_1000 - 0x2000_0C00)

Same logic applies for Vector Table section as well.

 

Is it correct to recognize that the size from 0x20000000 to 0x80 (up to 0x2000007F) is the area of the vector table?

 

Yes, that's right.

Hope this helps 🙂

Regards,
Dheeraj

View solution in original post

0 Likes
2 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @MaMi_1205306 ,

Yes in the map file, you will get the start addresses and the end addresses of each of the memory sections along with the size they occupy. For example,

DheerajK_81_1-1615831347341.png

 

You can see here that the stack starts at 0x2000_1800 and extends to 0x2000_2000,  with the total size of the stack being 0x800. This region forms the stack area.

Another way to calculate this based on the linker script logic is:
Lets say the SRAM is 4KB (0x2000_0000 - 0x2000_1000). So if the stack size if configured as 0x400, then you can say that the stack region starts from end of the RAM to 0x400 bytes down. i.e 0x2000_1000 - 0x2000_0C00)

Same logic applies for Vector Table section as well.

 

Is it correct to recognize that the size from 0x20000000 to 0x80 (up to 0x2000007F) is the area of the vector table?

 

Yes, that's right.

Hope this helps 🙂

Regards,
Dheeraj

0 Likes
MaMi_1205306
Level 7
Level 7
500 replies posted 50 solutions authored 25 likes received

Dheeraj-san,

Until now, I had a vague understanding,
I understood it correctly in your explanation.

Thank you,

0 Likes