Other Parts Discussed in Thread: UNIFLASH
In order to make the bootloader load 1 of 2 application images available depending on a bit set in a flash segment, I have modified the boot_serial_emac_flash example.
bl_config.h: replaced APP_START_ADDRESS by two new variables plus the position of the selector variable
#define APP_START_ADDRESS1 0x0000A000 #define APP_START_ADDRESS2 0x00100000 #define APP_SELECT 0x00009FFC
On bl_startup_css, I keep importing the header file as before:
.cdecls C, NOLIST, WARN
%{
#include "bl_config.h"
%}
In order to do the switching, I added the following code after the ProcessorInit line:
;;
;; Initialize the processor.
;;
bl ProcessorInit
;; NEW CODE STARTS HERE
;; Read the value of the memory address and store it in APP_SELECT.
;;
ldr r5, APP_SELECT
ldr r6, [r5]
str r6, APP_SELECT
;;
;; Check if mem_value is 0 or 1, and select the APP_START_ADDRESS accordingly.
;;
cmp r6, #0
beq use_app1
cmp r6, #1
beq use_app2
;;
;; Check if mem_value is 0 or 1, and select the APP_START_ADDRESS accordingly.
;;
cmp r6, #0
beq use_app1
cmp r6, #1
beq use_app2
use_app1:
ldr r5, APP_START_ADDRESS1
b continue
use_app2:
ldr r5, APP_START_ADDRESS2
continue:
;; NEW CODE ENDS HERE
;; Call the user-supplied low level hardware initialization function
;; if provided.
;;
.if $$defined(BL_HW_INIT_FN_HOOK)
.ref BL_HW_INIT_FN_HOOK
bl BL_HW_INIT_FN_HOOK
.endif
The rest would then be done in the CallApplication function. However, I get a lot of illegal mnemonic errors starting with the first ldr line. Why?
Thank you and regards
Peter


