cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 4

HaYa_4104701
New Contributor

1. PSOC初始化程序放在哪个函数里

2. PSOC在启动时,是否会进行堆栈初始化?

请大牛帮忙

0 Likes
1 Solution
LinglingG_46
Moderator
Moderator

stack 和 heap的初始化是在cm0gcc.ld(如果是gcc编译器)

以附件工程为例:

1:找到 cm0gcc.ld 文件,

2:找到

    /* The .stack and .heap sections don't contain any symbols.
    * They are only used for linker to calculate RAM utilization.
    */
    .heap (NOLOAD) :
    {
      . = _end;
      . += 0x80;
      __cy_heap_limit = .;
    } >ram

    .stack (__cy_stack - 0x0800) (NOLOAD) :
    {
      __cy_stack_limit = .;
      . += 0x0800;
    } >ram

/* Check if data + heap + stack exceeds RAM limit */

    ASSERT(__cy_stack_limit >= __cy_heap_limit, "region RAM overflowed with stack")

View solution in original post

0 Likes
3 Replies
LinglingG_46
Moderator
Moderator

1: 程序的初始化,你可以看工程编译之后,生成的文件 cy_boot。

   你可以看一下cyfitter_cfg.c 文件中,有没有想需要的部分。

2: 启动时,会进行堆栈初始化的。

0 Likes
HaYa_4104701
New Contributor

1. 没找到cyfitter_cfg.c

2. 初始化是把堆栈里的值全都置‘0’,是吗

pastedImage_0.png

0 Likes
LinglingG_46
Moderator
Moderator

stack 和 heap的初始化是在cm0gcc.ld(如果是gcc编译器)

以附件工程为例:

1:找到 cm0gcc.ld 文件,

2:找到

    /* The .stack and .heap sections don't contain any symbols.
    * They are only used for linker to calculate RAM utilization.
    */
    .heap (NOLOAD) :
    {
      . = _end;
      . += 0x80;
      __cy_heap_limit = .;
    } >ram

    .stack (__cy_stack - 0x0800) (NOLOAD) :
    {
      __cy_stack_limit = .;
      . += 0x0800;
    } >ram

/* Check if data + heap + stack exceeds RAM limit */

    ASSERT(__cy_stack_limit >= __cy_heap_limit, "region RAM overflowed with stack")

View solution in original post

0 Likes