Hi,
I am planning to execute few neon add instructions using startup_Cortex-R52 example project. I have created assembly file with neon instructions and added it to project. I have modified the target settings to use -march "armv8-r", mfpu to "neon" and float-abi to "Hardware(Software FPO Linkage)".
Is there any startup code that I need to add for enabling neon extension. Let me know how can I proceed regarding this.
Thanks,
Praveen.
Hi Praveen
The startup_Cortex-R52 example already has the necessary code to enable NEON in startup.S:
#ifdef __ARM_FP //---------------------------------------------------------------- // Enable access to VFP by enabling access to Coprocessors 10 and 11. // Enables Full Access i.e. in both privileged and non privileged modes //---------------------------------------------------------------- MRC p15, 0, r0, c1, c0, 2 // Read Coprocessor Access Control Register (CPACR) ORR r0, r0, #(0xF << 20) // Enable access to CP 10 & 11 MCR p15, 0, r0, c1, c0, 2 // Write Coprocessor Access Control Register (CPACR) ISB //---------------------------------------------------------------- // Switch on the VFP hardware //---------------------------------------------------------------- MOV r0, #0x40000000 VMSR FPEXC, r0 // Write FPEXC register, EN bit set #endif
In All Tools Settings > Target, I suggest you setTarget CPU = Cortex-R52Target FPU = Armv8 (Neon)Float ABI = Hardware
which results in the compiler command-line:armclang --target=arm-arm-none-eabi -mcpu=cortex-r52 -mfpu=neon-fp-armv8 -mfloat-abi=hard
Hope this helps
Stephen
Thanks Stephen for quick reply. I have made settings you proposed. I am seeing below error
make all Building file: ../doubleelements.sInvoking: Arm Assembler 6armclang.exe --target=arm-arm-none-eabi -mcpu=cortex-r52 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -g -c -o "doubleelements.o" "../doubleelements.s"Finished building: ../doubleelements.s Building file: ../main.cInvoking: Arm C Compiler 6armclang.exe --target=arm-arm-none-eabi -mcpu=cortex-r52 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -O0 -g -MD -MP -c -o "main.o" "../main.c"Finished building: ../main.c Building file: ../sorts.cInvoking: Arm C Compiler 6armclang.exe --target=arm-arm-none-eabi -mcpu=cortex-r52 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -O0 -g -MD -MP -c -o "sorts.o" "../sorts.c"Finished building: ../sorts.c Building file: ../startup.sInvoking: Arm Assembler 6armclang.exe --target=arm-arm-none-eabi -mcpu=cortex-r52 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm -g -c -o "startup.o" "../startup.s"../startup.s:268:9: error: invalid instruction, any one of the following would fix this: CPS #Mode_ABT ^../startup.s:268:21: note: too few operands for instruction CPS #Mode_ABT ^../startup.s:268:13: note: operand must be an immediate in the range [0,31] CPS #Mode_ABT ^../startup.s:271:9: error: invalid instruction, any one of the following would fix this: CPS #Mode_IRQ ^../startup.s:271:21: note: too few operands for instruction CPS #Mode_IRQ ^../startup.s:271:13: note: operand must be an immediate in the range [0,31] CPS #Mode_IRQ ^../startup.s:275:9: error: invalid instruction, any one of the following would fix this: CPS #Mode_FIQ ^../startup.s:275:21: note: too few operands for instruction CPS #Mode_FIQ ^../startup.s:275:13: note: operand must be an immediate in the range [0,31] CPS #Mode_FIQ ^../startup.s:279:9: error: invalid instruction, any one of the following would fix this: CPS #Mode_SVC ^../startup.s:279:21: note: too few operands for instruction CPS #Mode_SVC ^../startup.s:279:13: note: operand must be an immediate in the range [0,31] CPS #Mode_SVC ^../startup.s:328:1: error: invalid symbol redefinitionLoop3: ORR r11, r10, r9, LSL r5 // Factor in the Way number and cache number into R11^../startup.s:328:9: error: invalid instruction, any one of the following would fix this:Loop3: ORR r11, r10, r9, LSL r5 // Factor in the Way number and cache number into R11 ^../startup.s:328:9: note: instruction requires: arm-modeLoop3: ORR r11, r10, r9, LSL r5 // Factor in the Way number and cache number into R11 ^../startup.s:328:31: note: invalid operand for instructionLoop3: ORR r11, r10, r9, LSL r5 // Factor in the Way number and cache number into R11 ^../startup.s:328:31: note: operand must be a register in range [r0, r14]Loop3: ORR r11, r10, r9, LSL r5 // Factor in the Way number and cache number into R11 ^../startup.s:329:9: error: invalid instruction, any one of the following would fix this: ORR r11, r11, r7, LSL r2 // Factor in the Set number ^../startup.s:329:9: note: instruction requires: arm-mode ORR r11, r11, r7, LSL r2 // Factor in the Set number ^../startup.s:329:31: note: invalid operand for instruction ORR r11, r11, r7, LSL r2 // Factor in the Set number ^../startup.s:329:31: note: operand must be a register in range [r0, r14] ORR r11, r11, r7, LSL r2 // Factor in the Set number ^make: *** [subdir.mk:29: startup.o] Error 1"make all" terminated with exit code 2. Build might be incomplete.
Added .s file include below code
.text .arm .global double_elementsdouble_elements:
vadd.i32 q0,q0,q0 bx lr .end
Regards,
Hi PraveenTo fix the assembler errors, add "-x assembler-with-cpp" into the Miscellaneous settings for Arm Assembler 6.Depending on how much code and RW data you've added, you may see data aborts occurring inside __scatterload_copy (and main() not being reached) due to the MPU CODE region exceeding its upper limit. You can fix that by increasing the size of the MPU region in startup.s, or moving the enabling of the MPU to after scatterloading has completed, e.g. inside main().Hope this helpsStephen
Hi Stephen,
After adding the "-x assembler-with-cpp" I am seeing below link error.
armlink.exe --info=sizes -o "startup_Cortex-R52.axf" ./doubleelements.o ./main.o ./sorts.o ./startup.o Error: L6218E: Undefined symbol Image$$ARM_LIB_HEAP$$Base (referred from startup.o).Error: L6218E: Undefined symbol Image$$ARM_LIB_STACK$$ZI$$Limit (referred from startup.o).Error: L6218E: Undefined symbol Image$$CODE$$Base (referred from startup.o).Error: L6218E: Undefined symbol Image$$CODE$$Limit (referred from startup.o).Error: L6218E: Undefined symbol Image$$DATA$$Base (referred from startup.o).Error: L6218E: Undefined symbol Image$$DATA$$ZI$$Limit (referred from startup.o).
ARM_LIB_HEAP is already defined in scatter.scat. Is there any other project that I could use for cortex-r52 + neon. Let me know if you have any working project available
Hi PraveenYour Arm DS project build appears to have lost some essential tool options, in particular, the name of the scatter file and the image entry point in the Arm Linker 6 > Image Layout settings.For the link-step, change your current:armlink.exe --info=totals -o "startup_Cortex-R52.axf" ./doubleelements.o ./main.o ./sorts.o ./startup.o so that it becomes:armlink.exe --entry=Start --scatter="../scatter.scat" --info=totals -o "../startup_Cortex-R52.axf" ./doubleelements.o ./main.o ./sorts.o ./startup.o
Thanks Stephen . This really helped alot.
Also I am trying to compile .cpp extensiopn files(main.c --> main.cpp ..). But .cpp files are not picked up for compilation and I am seeing error main not found.
My usecase is, I have .cpp based source code which I need to include in this project and create .axf. Is this workflow possible?
(To be more specific about my usecase, I am trying to include to include arm compute library to this startup project and create an app.)
Hi PraveenThat's strange - renaming main.c to main.cpp works for me with the startup_Cortex-R52 example supplied, after fixing up any call-outs (name mangling, etc) from the C++ file to extern C or assembler files.However, if the bulk of your application will be C++, then you must create a new C++ project. The startup_Cortex-R52 example supplied is only based on a C project template, not C++.
To create a new C++ project, use File > New > Project, then expand C/C++ and select "C++ Project". Then copy across all the project settings (processor, fpu, "-x assembler-with-cpp", --entry=Start --scatter, etc) from your existing project to the new project.If you need more help with this interesting project, I suggest you open an official Support case with Arm, using the "Support > Open a Support Case" option at the top of this page.Hope this helpsStephen
Thanks for suggestion I have raised a support case .
I want to know if there is a quick fix for below problem.
I have created C++ project and created .axf , however I am seeing issues while trying to run. It is not coming to main from "Start". Debug configurations are similar to the startup_cortex-r52.Attached project for your referenceACLPrototype.zip