Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 ARM Compiler 6编译器时有问题,需要修复 #1

Open
KemGong opened this issue Apr 6, 2023 · 0 comments
Open

使用 ARM Compiler 6编译器时有问题,需要修复 #1

KemGong opened this issue Apr 6, 2023 · 0 comments

Comments

@KemGong
Copy link
Owner

KemGong commented Apr 6, 2023

因为有一些mcu芯片只支持 ARM Compiler 6编译器,所以在初始化函数部分会有问题。
`void do_init_call(void)
{
#if defined(__CC_ARM) /* ARM Compiler */
extern initcall_t initcall0init$$Base[];
extern initcall_t initcall0init$$Limit[];
extern initcall_t initcall1init$$Base[];
extern initcall_t initcall1init$$Limit[];
extern initcall_t initcall2init$$Base[];
extern initcall_t initcall2init$$Limit[];

initcall_t *fn;

for (fn = initcall0init$$Base;
        fn < initcall0init$$Limit;
        fn++)
{
    if(fn)
        (*fn)();
}

for (fn = initcall1init$$Base;
        fn < initcall1init$$Limit;
        fn++)
{
    if(fn)
        (*fn)();
}

for (fn = initcall2init$$Base;
        fn < initcall2init$$Limit;
        fn++)
{
    if(fn)
        (*fn)();
}

#elif defined (GNUC)
extern initcall_t __initcall_start[];
extern initcall_t __initcall_end[];

initcall_t *start = __initcall_start;
initcall_t *end = __initcall_end;
initcall_t *fn;

for (fn = start; fn < end; fn++)
{
    printf("initcall fn 0x%x\r\n", fn);
    (*fn)();
}

#endif // defined
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant