Compiling 32 bit binaries for ARMv8

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Compiling 32 bit binaries for ARMv8

479 Views
fgalax
Contributor I

I am currently developing a bootloader code that modifies the execution state of an ARMv8-A processor from EL3 aarch64 to EL1 aarch32. In order to test its functionality, I must load and debug a small 32-bit segment within the microcontroller unit (MCU). It is evident that the step debugger will lose control of the program counter when the switch happens. However, disconnecting from aarch64 and attaching it with the aarch32 binaries would allow the debugging process to continue.

Currently, the IDE does not permit the creation of 32-bit projects, as only the aarch64 toolchain is available. I would like to know whether if it is possible and what is required for compiling and debugging a 32-bit file from CodeWarrior IDE.
At present, I am utilising CodeWarrior Development Studio for QorIQ LS series - ARM V8 ISA, Version: 11.5.12, with CodeWarrior TAP for debugging.

0 Kudos
Reply
7 Replies

436 Views
yipingwang
NXP TechSupport
NXP TechSupport

You could use 32bit toolchain provided in CodeWarrior for ARMv7 to build your program.

You could download and install CodeWarrior for ARMv7 from the following link.

https://support.nxp.com/s/case/5002p00002zokT5AAI/community-compiling-32-bit-binaries-for-armv8?lang...

Then in CodeWarrior for ARMv8 project configuring Toolchain settings as the following.

yipingwang_0-1715595181496.png

yipingwang_1-1715595232418.pngyipingwang_2-1715595251034.png

 

 

0 Kudos
Reply

386 Views
fgalax
Contributor I

Thanks for your answer, I managed to download the file and correctly configure my CodeWarrior armv8 with the provided armv7 toolchain. I now can compile 32 bit software but i still cannot debug it. I have created a GDB Hardware Debugging configuration and set the gdb executable in "C:\Freescale\CW_ARMv7_v2019.10\CW_ARMv7\Cross_Tools\gcc-linaro-arm-none-eabi-4.9.3\bin". Sadly, I encounter an error when trying to start a debugging session:

 

 

Error in final launch sequence:

Failed to execute MI command:

source C:\Freescale\CW4NET_v2020.06\CW_ARMv8\eclipse\..\ARMv8\gdb\bin\.gdbinit

Error message from debugger back end:

C:\Freescale\CW4NET_v2020.06\CW_ARMv8\eclipse\..\ARMv8\gdb\bin\.gdbinit:22: Error in sourced command file:

Scripting in the "Python" language is not supported in this copy of GDB.

 

 

0 Kudos
Reply

380 Views
yipingwang
NXP TechSupport
NXP TechSupport

After generating the 32 bit elf, please import the elf file from File->Import->C/C++->CodeWarrior Executable Importer to generate a bare board debug project.

0 Kudos
Reply

362 Views
fgalax
Contributor I

I have performed the steps you explained, then modified the debug sessions to not execute the target initialization script and not load the .elf into memory. This is because i would like to attach to my 32 bit code which is already running on the target. From this point i tried setting the pointing the gdb to:

1- CW ARMv8 gdb: it attaches and correctly identifies the architecture of the processor as an arm (aarch32). However It is not able to follow the program counter, breakpoints do not work, it can't step, not even from the debugger console (stepi), and the command "info registers" has too few registers to provide an understanding of the situation. In addition it does not account for the MMU being enabled and both the Memory Browser and Disassembler point to the physical addresses instead of the virtual ones, clearly missing the real location of the code and variables.

2- CW ARMv7 gdb: still have the same error complaining about python missing and debug does not start.

0 Kudos
Reply

356 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to ATF debugging procedure with CodeWarrior for ARMv8

https://community.nxp.com/t5/Layerscape-Knowledge-Base/Debugging-ATF-and-u-boot-with-CodeWarrior-for...

0 Kudos
Reply

341 Views
fgalax
Contributor I

Excellent guide, it works for 64 bit elf but sadly not for 32-bit ones. I am encountering the same debugging problems mentioned in my previous answer. For a quick reminder, it loads the symbols (and the source code), but it is unable to:

- step through the code;

- recognize the presence of the MMU enabled;

- stop at breakpoints;

- view 32-bit registers. 

0 Kudos
Reply

337 Views
yipingwang
NXP TechSupport
NXP TechSupport

If so, if is impossible to debug 32-bit elf with CodeWarrior for ARMv8.

0 Kudos
Reply