Skip to content

Commit 89f8f52

Browse files
committed
Modify enc_bootloader example to use latest mbedtls code from picotool
Also, fix stdio_uart and stdio_usb output when running clk_sys from rosc, and fix having stdio_usb in both the bootloader and the binary
1 parent a332881 commit 89f8f52

File tree

8 files changed

+184
-2059
lines changed

8 files changed

+184
-2059
lines changed

bootloaders/encrypted/CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# Encrypted Bootloader
22
add_executable(enc_bootloader
33
enc_bootloader.c
4-
aes.S
4+
mbedtls_aes.c
55
)
66

77
# pull in common dependencies
8-
target_link_libraries(enc_bootloader pico_stdlib pico_rand)
8+
target_link_libraries(enc_bootloader pico_stdlib pico_rand pico_mbedtls)
99

1010
# use stack guards, as AES variables are written near the stack
1111
target_compile_definitions(enc_bootloader PRIVATE PICO_USE_STACK_GUARDS=1)
1212

13+
target_link_options(enc_bootloader PUBLIC -Wl,--print-memory-usage)
14+
15+
target_include_directories(enc_bootloader PRIVATE ${CMAKE_CURRENT_LIST_DIR})
16+
1317
# set as no_flash binary
1418
pico_set_binary_type(enc_bootloader no_flash)
1519

@@ -35,8 +39,8 @@ function(add_linker_script target origin length)
3539
pico_set_linker_script(${target} ${CMAKE_CURRENT_BINARY_DIR}/${target}.ld)
3640
endfunction()
3741

38-
# create linker script to run from 0x20078000
39-
add_linker_script(enc_bootloader "0x20078000" "32k")
42+
# create linker script to run from 0x20070000
43+
add_linker_script(enc_bootloader "0x20070000" "64k")
4044

4145
# sign, hash, and clear SRAM
4246
pico_sign_binary(enc_bootloader ${CMAKE_CURRENT_LIST_DIR}/private.pem)
@@ -50,6 +54,9 @@ pico_embed_pt_in_binary(enc_bootloader ${CMAKE_CURRENT_LIST_DIR}/enc-pt.json)
5054
pico_set_uf2_family(enc_bootloader "absolute")
5155
pico_package_uf2_output(enc_bootloader 0x10000000)
5256

57+
# optionally enable USB output in addition to UART
58+
# pico_enable_stdio_usb(enc_bootloader 1)
59+
5360
# create map/bin/hex/uf2 file etc.
5461
pico_add_extra_outputs(enc_bootloader)
5562

@@ -83,6 +90,9 @@ pico_encrypt_binary(hello_serial_enc ${CMAKE_CURRENT_LIST_DIR}/privateaes.bin ${
8390
# package uf2 in flash
8491
pico_package_uf2_output(hello_serial_enc 0x10000000)
8592

93+
# optionally enable USB output in addition to UART
94+
# pico_enable_stdio_usb(hello_serial_enc 1)
95+
8696
# create map/bin/hex/uf2 file etc.
8797
pico_add_extra_outputs(hello_serial_enc)
8898

0 commit comments

Comments
 (0)