1
votes

Using MicroSemi SoftConsole 4.0 to try to get a FreeRTOS demo project compiled and running, and I've come across an error "bad instruction '[every line of code]'". Basically, the entire file is not being assembled for some reason. My Console looks like this:

Building file: ../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm
Invoking: Cross ARM GNU Assembler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O2  -g -x assembler-with-cpp -MMD -MP -MF"FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.d" -MT"FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.o" -c -o "FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.o" "../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm"
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm: Assembler messages:
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:37: Error: bad instruction `_text SEGMENT'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:38: Error: bad instruction `aes_cbc_encrypt PROC'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:46: Error: bad instruction `save rdi and rsi to rax and r11,restore before ret'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:47: Error: ARM register expected -- `mov rax,rdi'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:48: Error: immediate expression requires a # prefix -- `mov r11,rsi'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:50: Error: bad instruction `convert to what we had for att&t convention'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:51: Error: ARM register expected -- `mov rdi,rcx'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:52: Error: ARM register expected -- `mov rsi,rdx'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:53: Error: ARM register expected -- `mov rdx,r8'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:54: Error: ARM register expected -- `mov rcx,r9'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:55: Error: immediate expression requires a # prefix -- `mov r8,[rsp+40]'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:56: Error: ARM register expected -- `mov r9d,[rsp+48]'
../FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.asm:58: Error: bad instruction `end'
FreeRTOS-Plus/WolfSSL/wolfcrypt/src/subdir.mk:161: recipe for target 'FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.o' failed
make: *** [FreeRTOS-Plus/WolfSSL/wolfcrypt/src/aes_asm.o] Error 1

etc. etc. (it gives me an error for just about all 1000ish lines of code, which I've edited out for legibility of course). As can be noted, I'm using the Cross ARM GNU Assembler (arm-none-eabi-gcc), and my ARM assembler option is -x assembler-with-cpp. Not sure what else I need to include, but if someone knows of a potential assembler flag or option I might be missing somewhere in the command line, that would be very helpful. I'm not even 100% sure what's going on here myself, so any explanation as to what might be going wrong would be helpful too. I feel like this isn't really a coding problem, but more like a lack of compatibility issue (perhaps incorrect assembly format? Even though I'm using a cross-arm assembler). Thank you!

2
The file it's trying to assemble is not for ARM, it's for x86. That won't work.Jester
@Jester that's what I thought, but as I said to Richard, it was included in a software project that's meant for an ARM board, which is what's confusing me.Justin
I haven't checked but that project might be cross-platform, or might just include some code from elsewhere that is. Maybe the code you are trying to compile actually has an ARM specific or a generic C version too, just your build system is picking the wrong one to compile.Jester
@Jester you answered my question. Found out there was a file called "aes_asm.S" in the same directory, so I just excluded the .asm from the build, and the .S had no problems. Thanks!Justin

2 Answers

1
votes

Does not look like ARM asm code. Possible Intel code.

0
votes

@Richard is correct. That is our Intel assembly which assists in cryptographic acceleration on specific intel platforms.

You can fix this by adding the define NO_ASM in wolfSSL or by excluding any files ending in .asm from your project.