From e56c7d53c45379038b22c4da310ca2757a67f62f Mon Sep 17 00:00:00 2001 From: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:25:12 -0500 Subject: [PATCH] Updated Building External Apps (markdown) --- Building-External-Apps.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Building-External-Apps.md b/Building-External-Apps.md index c237c82..c85850b 100644 --- a/Building-External-Apps.md +++ b/Building-External-Apps.md @@ -1,4 +1,4 @@ -External apps are similar to internal apps in that they are compiled and linked with the rest of the firmware, but at the link stage a fake memory address range is specified for each external app in the "external.ld" file. After linking, the external apps are removed from the firmware image and extracted to separate files. Note that LTO optimization cannot be used when linking the external apps, to prevent the linker from attempting to share code between external apps. +External apps are similar to internal apps in that they are compiled and linked with the rest of the firmware, but at the link stage a fake memory address range is specified for each external app in the "external.ld" file. After linking, the external apps are removed from the firmware image and extracted to separate files. This is quite different from baseband modules that are each compiled and linked separately, run on a different CPU (the M4), and communicate with the main firmware via a message protocol. Note that LTO optimization cannot be used when linking the external apps, to prevent the linker from attempting to share code between external apps. ## export_external_apps.py The export_external_app python script edits each external app image to (1) replace the fake memory addresses used during the linker stage with actual RAM addresses where the external app will be loaded to be executed, (2) append any needed baseband image, and (3) adds a file checksum to verify integrity during the untar process. @@ -11,7 +11,7 @@ As example, if the fake address range of an app is 0xADC00000 to 0xADC07FFF, thi Note that the fake 0xADxxxxxx address range was selected for external apps based on few data values in this range in the firmware image, and because any firmware attempts to access this fake memory address range will trigger a GURU meditation fault. ### External App Baseband Images -Baseband modules for external apps are created exactly the same as baseband images for internal apps, but they are omitted from the firmware ROM and appended to the external app image using the python script mentioned above. +Baseband modules for external apps are created exactly the same as baseband images for internal apps, are compressed, and execute from RAM on the M4 processor as all baseband modules do. But, external app baseband images are omitted from the firmware ROM and are instead appended to the external app image using the python script mentioned above. ### External App Checksum The checksum used for external app image files is simply a uint32 sum of all 32-bit values in the image file, with the sign finally inverted such that the total (including checksum) will sum to 0 if it's a valid image. This simple checksum method is used for speed (CRC32 would be slower).