The nrf5340-app-hal is designed to run in non-secure mode. To use it, you must use a bootloader (like Nordic's Secure Partition Manager) that starts in secure mode, configures peripherals for the non-secure world, and then jumps to your application.
Memory Layout Requirements
When using Nordic's Secure Partition Manager (SPM) v1.7, your application is expected to start at flash address 0x0005_0000. You must configure your memory.x file to reflect this start address.
Verifying the Start Address
You can verify the expected non-secure (NS) image address by checking the boot-up logs. For example:
SPM: NS image at 0x50000 indicates the SPM is looking for the image at 0x0005_0000.
Customizing Flash Addresses
If you need to change the flash address, provide a custom memory.x file in your application crate (or Board Support Crate) and use a build.rs file to copy it into the build directory.