Assembly file(.S) compilation fails. [message #1828707] |
Wed, 17 June 2020 06:59 |
Utsav kumar Messages: 5 Registered: June 2020 |
Junior Member |
|
|
Environment: GNU arm toolchain for ARM7 in Eclipse photon.
Requirement: Porting from keil ARMCC to GNU arm toolchain in eclipse.
Compiled and build properly. When I added an assembly file .S(attached), facing compilation errors (Pasted below).
I tried to solve for two days, unfortunately, it didn't work.
Can someone please help.
Thanks.
12:18:38 **** Build of configuration Debug for project LEDblink ****
make all
Building file: ../LPC2468_startup.c
Invoking: GNU ARM Cross C Compiler
arm-none-eabi-gcc -mcpu=arm7tdmi-s -march=armv4t -marm -mthumb-interwork -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -include"E:\EclipseARM\workspace\LEDblink\iap_blue.S" -std=gnu11 -MMD -MP -MF"LPC2468_startup.d" -MT"LPC2468_startup.o" -c -o "LPC2468_startup.o" "../LPC2468_startup.c"
In file included from <command-line>:
E:\EclipseARM\workspace\LEDblink\iap_blue.S:1:13: error: expected identifier or '(' before '.' token
1 | .section .text,"x"
| ^
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:17: error: unknown type name 'ADD'
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^~~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:31: error: stray '#' in program
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:32: error: expected identifier or '(' before numeric constant
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^~~~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:14:17: error: unknown type name 'BX'
14 | BX LR // Return
| ^~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:15:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
15 | .end
| ^
In file included from c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\arm-none-eabi\include\stdint.h:14,
from c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\lib\gcc\arm-none-eabi\9.2.1\include\stdint.h:9,
from ../LPC2468_startup.c:1:
c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\arm-none-eabi\include\sys\_stdint.h:20:9: error: unknown type name '__int8_t'
20 | typedef __int8_t int8_t ;
| ^~~~~~~~
subdir.mk:31: recipe for target 'LPC2468_startup.o' failed
make: *** [LPC2468_startup.o] Error 1
12:18:39 Build Failed. 9 errors, 0 warnings. (took 764ms)
-
Attachment: iap_blue.S
(Size: 0.57KB, Downloaded 93 times)
|
|
|
|
|
Re: Assembly file(.S) compilation fails. [message #1828795 is a reply to message #1828707] |
Thu, 18 June 2020 17:33 |
Tauno Voipio Messages: 742 Registered: August 2014 |
Senior Member |
|
|
I got curious and made an Eclipse CDT project of your code.
The only thing slightly wrong was the attempt to redefine the section .text.
For calling IAP, you do not need assembly code, but the GCC embedded assembly can be used pretty easily.
In the attached zip, there are a testing main program to call the modules, your module and three competing versions written in GCC code:
blue1.c is your module ported to GCC embedded C,
blue2.c is the simplest way to call IAP, with minimal code (3 words).
In all the previous pieces of code, there is a potential gotcha: If the IAP ROM code does the return with some other instruction than bx, the code does not return to 32 bit ARM mode on return and goes totally lost.
blue3.c is a GCC embedded assembly piece with guranteed return from Thumb mode.
The zip file contains the complete Eclipse CDT project in own directory 'blue' to run a makefile compilation of the test packet, and assembly listings of the compilations.
-
Attachment: blue.zip
(Size: 23.71KB, Downloaded 111 times)
--
Tauno Voipio
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04114 seconds