Skip to content

Commit

Permalink
MCUBoot Graphic OK
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed May 16, 2020
1 parent c71bf50 commit 1ea351c
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 36 deletions.
49 changes: 25 additions & 24 deletions hw/bsp/nrf52/bsp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,36 @@ bsp.debugscript.WINDOWS.OVERWRITE: "hw/bsp/nrf52/nrf52_debug.cmd"
bsp.flash_map:
areas:
# System areas.
FLASH_AREA_BOOTLOADER: # MCUBoot
device: 0 # Internal Flash ROM
offset: 0x00000000 # Start of Internal Flash ROM
size: 24kB
FLASH_AREA_IMAGE_0: # Active Firmware Image
device: 0 # Internal Flash ROM
offset: 0x00008000
size: 464kB # Max size of Firmware Image
FLASH_AREA_IMAGE_1: # Standby Firmware Image
device: 1 # External SPI Flash
offset: 0x00040000
size: 464kB # Max size of Firmware Image
FLASH_AREA_IMAGE_SCRATCH: # Used by MCUBoot for swapping Active and Standby Firmware
device: 0 # Internal Flash ROM
offset: 0x0007c000
size: 4kB
FLASH_AREA_BOOTLOADER: # MCUBoot
device: 0 # Internal Flash ROM
offset: 0x00000000 # Start of Internal Flash ROM
size: 24kB
FLASH_AREA_IMAGE_0: # Active Firmware Image
device: 0 # Internal Flash ROM
offset: 0x00008000
size: 464kB # Max size of Firmware Image
FLASH_AREA_IMAGE_1: # Standby Firmware Image
device: 1 # External SPI Flash
offset: 0x00040000
size: 464kB # Max size of Firmware Image
FLASH_AREA_IMAGE_SCRATCH: # Used by MCUBoot for swapping Active and Standby Firmware
device: 0 # Internal Flash ROM
offset: 0x0007c000
size: 4kB

# User areas.
FLASH_AREA_REBOOT_LOG: # For logging debug messages during startup
FLASH_AREA_REBOOT_LOG: # For logging debug messages during startup
user_id: 0
device: 0 # Internal Flash ROM
device: 0 # Internal Flash ROM
offset: 0x00006000
size: 8kB
FLASH_AREA_BOOTLOADER_ASSET: # Bootloader Assets, like Boot Graphic
device: 1 # External SPI Flash
offset: 0x00000000 # Start of External SPI Flash
size: 256kB
FLASH_AREA_NFFS: # For user files
# FLASH_AREA_BOOTLOADER_ASSET: # Bootloader Assets, like Boot Graphic
# user_id: 1
# device: 1 # External SPI Flash
# offset: 0x00000000 # Start of External SPI Flash
# size: 256kB
FLASH_AREA_NFFS: # For user files
user_id: 1
device: 1 # External SPI Flash
device: 1 # External SPI Flash
offset: 0x000b4000
size: 3376kB
36 changes: 34 additions & 2 deletions libs/pinetime_boot/src/pinetime_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void boot_custom_start(
) {
// Wait 5 seconds for button press.
console_printf("Button: %d\n", hal_gpio_read(PUSH_BUTTON_IN)); console_flush();
for (int i = 0; i < 100; i++) {
for (int i = 0; i < 15; i++) {
pinetime_boot_check_button();
}
console_printf("Button: %d\n", hal_gpio_read(PUSH_BUTTON_IN)); console_flush();
Expand All @@ -68,4 +68,36 @@ void pinetime_boot_check_button(void) {
for (int i = 0; i < 1000000; i++) {
hal_gpio_read(PUSH_BUTTON_IN);
}
}
}

/* Log:
Starting Bootloader...
Displaying image...
Image displayed
Button: 0
[INF] Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Boot source: primary slot
[INF] Swap type: none
Button: 0
Button: 0
Bootloader done
TMP create temp_stub_0
NET hwid 4a f8 cf 95 6a be c1 f6 89 ba 12 1a
NET standalone node
Testing flash...
Read Internal Flash ROM...
Read 0x0 + 20
0x0000: 0x00 0x00 0x01 0x20 0xd9 0x00 0x00 0x00
0x0008: 0x35 0x01 0x00 0x00 0x37 0x01 0x00 0x00
0x0010: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x0018: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Read External SPI Flash...
Read 0x0 + 20
0x0000: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x0008: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x0010: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x0018: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Flash OK
Rust test display
*/
2 changes: 1 addition & 1 deletion logs/libapp.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions logs/my_sensor_app.elf.lst
Original file line number Diff line number Diff line change
Expand Up @@ -132426,9 +132426,9 @@ os_free(void *mem)
0003a8ec <sysflash_map_dflt>:
...
3a8f4: 00006000 00000001 00008000 00074000 .`...........@..
3a904: 00000102 00000000 00074000 00000003 .........@......
3a904: 00000102 00040000 00074000 00000003 .........@......
3a914: 0007c000 00001000 00000010 00006000 .............`..
3a924: 00002000 00000111 00074000 0038c000 . .......@....8.
3a924: 00002000 00000111 000b4000 0034c000 . .......@....4.

0003a934 <boot_img_magic>:
3a934: f395c277 7fefd260 0f505235 8079b62c w...`...5RP.,.y.
Expand Down
14 changes: 7 additions & 7 deletions logs/mynewt.elf.lst
Original file line number Diff line number Diff line change
Expand Up @@ -6683,14 +6683,14 @@ void pinetime_boot_check_button(void) {
1e7a: 4810 ldr r0, [pc, #64] ; (1ebc <boot_custom_start+0x50>)
1e7c: f000 fa4a bl 2314 <console_printf>
1e80: f000 fa9e bl 23c0 <console_flush>
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 15; i++) {
1e84: 2400 movs r4, #0
1e86: e002 b.n 1e8e <boot_custom_start+0x22>
pinetime_boot_check_button();
1e88: f7ff ffe2 bl 1e50 <pinetime_boot_check_button>
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 15; i++) {
1e8c: 3401 adds r4, #1
1e8e: 2c09 cmp r4, #9
1e8e: 2c0e cmp r4, #14
1e90: ddfa ble.n 1e88 <boot_custom_start+0x1c>
console_printf("Button: %d\n", hal_gpio_read(PUSH_BUTTON_IN)); console_flush();
1e92: 200d movs r0, #13
Expand Down Expand Up @@ -6748,10 +6748,10 @@ static int hard_reset(void) {
/// Sleep for the specified number of milliseconds
static void delay_ms(uint32_t ms) {
1ee2: b508 push {r3, lr}
#if MYNEWT_VAL(OS_SCHEDULING) // If Task Scheduler is enabled...
#if MYNEWT_VAL(OS_SCHEDULING) // If Task Scheduler is enabled (i.e. not MCUBoot)...
uint32_t delay_ticks = ms * OS_TICKS_PER_SEC / 1000;
os_time_delay(delay_ticks);
#else
#else // If Task Scheduler is disabled (i.e. MCUBoot)...
// os_time_delay() doesn't work in MCUBoot because the scheduler has not started
pinetime_boot_check_button();
1ee4: f7ff ffb4 bl 1e50 <pinetime_boot_check_button>
Expand Down Expand Up @@ -15539,9 +15539,9 @@ err:
000057fc <sysflash_map_dflt>:
...
5804: 6000 0000 0001 0000 8000 0000 4000 0007 .`...........@..
5814: 0102 0000 0000 0000 4000 0007 0003 0000 .........@......
5814: 0102 0000 0000 0004 4000 0007 0003 0000 .........@......
5824: c000 0007 1000 0000 0010 0000 6000 0000 .............`..
5834: 2000 0000 0111 0000 4000 0007 c000 0038 . .......@....8.
5834: 2000 0000 0111 0000 4000 000b c000 0034 . .......@....4.

/Users/Luppy/PineTime/pinetime-rust-mynewt/bin/targets/nrf52_boot/app/boot/mynewt/mynewt.elf: file format elf32-littlearm

Expand Down

0 comments on commit 1ea351c

Please sign in to comment.