Hi all! =)
I just start working with arm926ej-s (an old board with Linux kernel 2.6.28, for wich I need write one small programm; got from the employee who quit).
I try to use ARM DS with GNU Toolchain for the A-profile Architecture: 8.2-2018.08 August 31, 2018 on Ubuntu (don't find toolchain with soft poin to Windows).
I use keys for project: -c -fmessage-length=0 -mcpu=arm926ej-s -mfloat-abi=soft -mthumb -mthumb-interwork
Compile Hello World programm, but when I start it on the board, It falls fith error "Illegal instruction". I find some topics, after then I find some tipic else and add D__ARM_ARCH_5TEJ__ define, also add __asm__ __volatile__ ("" : : : "memory"), but "Illegal instruction" again.
My code:
#include <iostream> using namespace std; int main() { __asm__ __volatile__ ("" : : : "memory"); while (true){ cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! for (volatile int i = 0; i < 19200000; ++i){} } return 0; }
Compiler output:
01:38:12 **** Incremental Build of configuration Debug for project Test **** make all Building file: ../src/Test.cpp Invoking: GCC C++ Compiler 8.2.1 [arm-linux-gnueabi] arm-linux-gnueabi-g++ -std=c++98 -D__ARM_ARCH_5TEJ__ -O0 -g3 -Wall -c -fmessage-length=0 -mcpu=arm926ej-s -mfloat-abi=soft -mthumb -mthumb-interwork -fpic -MMD -MP -MF"src/Test.d" -MT"src/Test.o" -o "src/Test.o" "../src/Test.cpp" Finished building: ../src/Test.cpp Building target: Test Invoking: GCC C++ Linker 8.2.1 [arm-linux-gnueabi] arm-linux-gnueabi-g++ -s -mcpu=arm926ej-s -mfloat-abi=soft -mthumb -mthumb-interwork -o "Test" ./src/Test.o Finished building target: Test 01:38:15 Build Finished. 0 errors, 0 warnings. (took 3s.345ms)
Is anyone know, what I can try else? =)
I've tried to execute a tsduck application on an ARM926EJ-S device running linux as OS.The application crashes immediately with the message 'illegal instruction'.
This error is caused by the memory barrier code that uses the MCR assembler instruction, because on ARM926EJ-S CPUs this instruction can only be executed in priviliged mode.
For now I replaced it with the following code that should prevent that the compiler reorders memory access.__asm__ __volatile__ ("" : : : "memory");
__asm__ __volatile__ ("" : : : "memory");
View all questions in Classic processors forum