gcc hello.c -S -mthumb I have the error :
Code: Select all
hello.c: In function ‘main’:
hello.c:6:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
{
^
I use a raspberry pi zero w with raspbian.
Code: Select all
hello.c: In function ‘main’:
hello.c:6:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
{
^
Code: Select all
gcc hello.c -S -mthumb -mcpu=cortex-a7Code: Select all
gcc hello.c -S -mthumb -mfloat-abi=softIts been around on various C compilers since the dawn of time.
Code: Select all
-s Remove all symbol table and relocation information from the executable.Yes I agree, certainly for thumb1 anyway. Thumb2 is much more useful because it has all the resources of the 32-bit instructions available too including NEON.Thumb instructions were intended for very memory limited ARM micro-controllers.
Yes.
The S is uppercase in -S option.
It generates a file .s with the assembler code.-S Compile only; do not assemble or link.
Yes, that is a linker message - nothing at all to do with the compiler.
Code: Select all
-s
--strip-all
Omit all symbol information from the output file.
-S
--strip-debug
Omit debugger symbol information (but not all symbols) from the output file.
OK fair enough.
Do you mean by hand?
Do you want to do this to make it easier for you to code it?very simple and reduced set of instruction
we decided to use the pi zero just because we have it but it's not obligatory to use it.
My question about the use of -mthumb on a pi3 is: if I use this option, is the assembly code entirely composed by Thumb instructions (16 bits) ?
Yes, by hand with the command
Code: Select all
gcc -S hello.c -mthumb
On the Pi2 and later (that is ARMv7 or ARMv8) then it is "thumb2" which is easier to use. It is a mixture of 16 and 32-bit instructions.
That is not by hand, that is using the compiler!!!crumb_er wrote: ↑Fri Mar 30, 2018 1:20 pmYes, by hand with the commandCode: Select all
gcc -S hello.c -mthumb
so it's not possible to do this only with the compiler?jahboater wrote: ↑Fri Mar 30, 2018 1:28 pmThat is not by hand, that is using the compiler!!!crumb_er wrote: ↑Fri Mar 30, 2018 1:20 pmYes, by hand with the commandCode: Select all
gcc -S hello.c -mthumb
Code: Select all
pi@pi3:~ $ gcc hello.c -o hello
pi@pi3:~ $ size hello
text data bss dec hex filename
828 280 4 1112 458 hello
pi@pi3:~ $ gcc hello.c -mthumb -o hello
pi@pi3:~ $ size hello
text data bss dec hex filename
812 280 4 1096 448 hello
pi@pi3:~ $ ./hello
hello world
Code: Select all
.type Disk_to_mem, %function
Disk_to_mem:
2DE9F047 push {r4, r5, r6, r7, r8, r9, r10, lr} @
8946 mov r9, r1 @ vs_u, vs_u
@ try.c:3478: const int fd = in_fd ? : open( fname, O_RDONLY );
1646 mov r6, r2 @ in_fd, in_fd
@ try.c:3475: {
ADF5403D sub sp, sp, #196608 @,,
98B0 sub sp, sp, #96 @,,
@ try.c:3478: const int fd = in_fd ? : open( fname, O_RDONLY );
1AB9 cbnz r2, .L1249 @ in_fd,
@ try.c:3478: const int fd = in_fd ? : open( fname, O_RDONLY );
1146 mov r1, r2 @, in_fd
FFF7FEFF bl open @
0646 mov r6, r0 @ in_fd,
.L1249:
@ try.c:3480: if( fd < 0 )
002E cmp r6, #0 @ in_fd,
07DA bge .L1250 @,
@ try.c:3481: return fail(0);
0020 movs r0, #0 @,
.L1281:
@ try.c:3570: return fail(0);
FDF717FB bl fail @
.L1279:
@ try.c:3573: }
0DF5403D add sp, sp, #196608 @,,
18B0 add sp, sp, #96 @,,
@ sp needed @
BDE8F087 pop {r4, r5, r6, r7, r8, r9, r10, pc} @
.L1250:
@ try.c:3483: if( fstat( fd, &details ) != 0 )
02A9 add r1, sp, #8 @ tmp196,,
3046 mov r0, r6 @, in_fd
FFF7FEFF bl fstat @
0DF16008 add r8, sp, #96 @ tmp144,,
0246 mov r2, r0 @ _1,
08B1 cbz r0, .L1252 @ _1,
.L1282:
@ try.c:3509: return fail(fd);
3046 mov r0, r6 @, in_fd
EEE7 b .L1281 @
.L1252:
@ try.c:3487: if( S_ISREG(fm) )
069C ldr r4, [sp, #24] @ details.st_mode, details.st_mode
04F47044 and r4, r4, #61440 @ _2, details.st_mode,
B4F5004F cmp r4, #32768 @ _2,
2CD1 bne .L1253 @,
@ try.c:2304: posix_fadvise( fd, 0, 0, POSIX_FADV_SEQUENTIAL );
0146 mov r1, r0 @, tmp2
0223 movs r3, #2 @,
3046 mov r0, r6 @, in_fd
FFF7FEFF bl posix_fadvise @
.L1254:
@ try.c:3516: if( vs_u == in_u )
3D4B ldr r3, .L1283 @ tmp153,
5B69 ldr r3, [r3, #20] @ in_u, in_u
4B45 cmp r3, r9 @ in_u, vs_u
07D1 bne .L1257 @,
@ try.c:3518: if( S_ISREG(fm) )
B4F5004F cmp r4, #32768 @ _2,
36D1 bne .L1258 @,