how to call c function in main.c from assembly

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

cross mob
vizh_468401
Level 1
Level 1
First question asked First reply posted

Dear,

please help to advise how to call a c function of main.c file from assembly file, i'm using creator/cy8c4127zai for the design now.

b/r

vincent

0 Likes
4 Replies
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

对于arm体系来说,不同语言撰写的函数之间相互调用(mix calls)遵循的是ATPCS(ARM-Thumb Procedure Call Standard), ATPCS 主要是定义了函数呼叫时参数的传递规则以及如何从函数返回。

1: 建议参考链接的方式:在汇编程序中调用C函数_车子(chezi)-CSDN博客_汇编调用c函数

2:   ARM GCC Inline Assembler Cookbook

0 Likes
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

对于arm体系来说,不同语言撰写的函数之间相互调用(mix calls)遵循的是ATPCS(ARM-Thumb Procedure Call Standard), ATPCS 主要是定义了函数呼叫时参数的传递规则以及如何从函数返回。

1: 建议参考链接的方式:在汇编程序中调用C函数_车子(chezi)-CSDN博客_汇编调用c函数

2:   ARM GCC Inline Assembler Cookbook

0 Likes

已经尝试过,编译出错,不清楚为什么CYPRESS的M0汇编很多指令不支持。

如下图所示,虽然B/BL指令没有报错,但是实际调试的时候不会跳转到对应的标号程序处....

捕获.PNG

0 Likes
Roy_Liu
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 10 questions asked

不好意思,这个论坛恐怕帮不了你这个问题。大家大都对C比较熟,没什么人熟悉汇编编程了。

Roy Liu
0 Likes