Firmware Updated
Firmware Updated
Firmware
• Agenda
– Firmware & Bootloader
– General Process of a firmware
– ARM Firmware Suite
– Redboot (Redhat)
– Sandstone (Sloss)
10.1 Firmware and Bootloader
Definitions
A minimal system
A Real Case: Sandstone
• Implementation
– It is specific to the ARM Evaluator-7T platform.
– This example shows you How a simple platform
be set.
10.2.1 Directory layout of
Sandstone
– sandstone_init1
– LDR r3, =SYSCFG
– LDR r4, =0x03FFFFA0 ; b[31:16]=base,
[15:0]=cfg
» ; Disable both the “cache” and “write-
buffer”
– STR r4, [r3]
– ……...
– B sandstone_memorycode
10.2.2.2 Start Initializing the
Hardware
– LDR r3, =SYSCFG
In this case, we have picked the default address
0x03ff0000, since this places all the hardware system
registers away from
both ROM and RAM,separating the peripherals and
memory.
10.2.2.2 Start Initializing the
Hardware
– LDR r4, =0x03FFFFA0 ; b[31:16]=base,
[15:0]=cfg
– ; Disable both the “cache” and
“write-buffer”
– Upper 16 Bits (Bits 31–16) → 0x03FF
– Meaning Start looking at system config
registers from 0x03FF0000
– Lower 16 Bits (Bits 15–0) → 0xFFA0
– Meaning Bit 7 = 1 → Write buffer is enabled
– Bit 6 = 0 → Cache is disabled
10.2.2.2 Start Initializing the
Hardware
– The results of executing step 2 are the
following:
– ■ Thesystemregisters are set from a
known base address—0x03ff0000.
– ■ Thesegmentdisplay is configured, so
that it can be used to display progress.
10.2.2.3 Remap Memory
• As you see,
– when the platform is powered up, only ROM is
assigned a location in the memory map.
– The two SRAM bank (0 and 1) are not available.
• We should
– bring in the two SRAM banks, and
– remap the ROM to a new location
Remap the ROM, and Setup
SRAM
– LDR r14, =sandstone_init2
– LDR r4, =0x1800000
– ADD r14, r14,r4 ; calculate the absolute
address
– ADRL r0, memorymaptable_str ; get address of table
– LDMIA r0, {r1-r12}
– LDR r0, =EXTDBWTH ; =(SYSCFG + 0x3010)
– STMIA r0, {r1-r12} ; setup DBus Width
– MOV pc, r14 ; JUMP to remapped memory (*)
– memorymaptable_str
– DCD rEXTDBWTH ; ROM0(Half), ROM1(Word), ROM1(Word), rest Disabled
– DCD rROMCON0 ; 0x1800000 ~ 0x1880000, RCS0, 4Mbit, 4cycle, ROM
– DCD rROMCON1 ; 0x0000000 ~ 0x0040000, RCS1, 256KB, 2cycle,
SRAM1
– DCD rROMCON2 ; 0x0040000 ~ 0x0080000, RCS2, 256KB, 2cycle,
SRAM2
–sandstone_load_and_boot
– The first part of the code sets up the registers r12, r13, and
r14 used in the block copy. The bootloader code assumes
that the payload is a plain binary image that requires no
deciphering or uncompressing
10.2.2.5 Bootloader
Copy Payload and Relinquish Control
– block copy
– LDMIA r12!,{r0-r11}
– STMIA r13!,{r0-r11}
– CMP r12,r14
– BLE block_copy
– block copy
– LDMIA r12!,{r0-r11}
– STMIA r13!,{r0-r11}
– CMP r12,r14
– BLE block_copy
– payload_start_address
– DCD startAddress
– payload_end_address
– DCD endAddress
Relinquish Control
10.3 Summary
• This chapter covered the firmware
– We define firmware as the low-level code that interfaces the
hardware with an application or operating system.
– We also define bootloader as the software that loads an
operating system or application into memory and relinquishes
control of the PC to that software.
– We introduced the ARM Firmware Suite (AFS) and RedBoot.
– Next, we looked at a firmware example called Sandstone.
» Sandstone initialized the hardware and then loads and
boots an image following this procedure:
• Take the reset exception
• Starts initializing the hardware; sets the system register’s base address
and initializes segment display hardware.
• Remaps memory; ROM address = high, and SRAM addr = 0x00000000.
• Initializes the communication hardware output on the serial port.
• Bootloader – loads an image into SRAM and relinquishes control of the PC
to the image (PC=0x00000000).