I have Cortex A9 dual core CPU on my board. And some of my legacy code is based on Big Endian (during PowerPC era).
I want to change the mode to "Big Endian" at my OS layer level and run all my legacy code. When I checked the manual,
ARMv7-A manual, it looks the instruction SETEND <endian specifier> sets the corresponding Endian mode of the processor.
But, I am not sure WHERE to set this. Should I set at my boot loader code ? Does changing the Endian mode of the processor triggers
a reset of the processor?
I have the following set-up in my system.
Power-on-Reset---> Execution of Boot ROM code --> Execution of boot loader ---> OS Kernel --> Drivers and Applications
There are some preliminary level initialization routines flashed into Boot ROM which is completely a hidden black box from user point of view.
How can I change the Endianness to Big Endian and run my legacy code?
Any hints or insights will be much helpful
There are multiple ways to do this.
The EE bit in the CP15 System Control Register (SCR) determines the endianness set on exception (i.e. the endianness of the OS itself). The input signals to the processor CFGEND[N:0] determine the initial value of the EE bit on boot if you want to boot directly into big endian code.
For application processes SETEND sets the endianness in the CPSR (current program status register) so this can be configured per process, and you can switch endianness mid-execution if you only have some data buffer which are in a different endianness to normal without having to flip the entire codebase. If an entire application you want to run is big-endian then your OS code which creates the process sandbox can set up the initial PSR value to be in big-endian mode when starting the process.
Thanks. Much helpful hint.
So, in case If I don`t use an RTOS in my system, I can set the Endian mode (thro SETEND) at the end of the boot loader code and call my big Endian based application code.
View all questions in Cortex-A / A-Profile forum