zephyr/samples/boards/intel_adsp/code_relocation
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
..
src samples, tests, boards: Switch main return type from void to int 2023-04-14 07:49:41 +09:00
CMakeLists.txt
README.rst
app.overlay
linker_xtensa_intel_adsp_cavs.ld
prj.conf
sample.yaml tests: remove intel adsp cavs platforms from filters 2023-04-06 18:51:56 +02:00

README.rst

.. _intel_adsp_code_relocation:

Intel ADSP CAVS Code relocation
###############################

Overview
********

A simple sample that shows code relocation working for Intel ADSP CAVS
boards (v18 and v25). The interesting bit is the custom linker file.
As rimage (the tool used to sign the image) mandates that elf files
sections TEXT, DATA and BSS be contiguous, some work is done in the
linker script to ensure that.


Building and Running
********************

This application can be built and executed as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/hello_world
   :board: intel_adsp_cavs25
   :goals: build
   :compact:


Sample Output
=============

.. code-block:: console

    main location: 0xbe0105e4
    Calling relocated code
    Relocated code! reloc location 0xbe008010
    maybe_bss location: 0x9e004218 maybe_bss value: 0