1
1
# Encrypted Bootloader
2
2
add_executable (enc_bootloader
3
3
enc_bootloader.c
4
- aes.S
4
+ mbedtls_aes.c
5
5
)
6
6
7
7
# 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 )
9
9
10
10
# use stack guards, as AES variables are written near the stack
11
11
target_compile_definitions (enc_bootloader PRIVATE PICO_USE_STACK_GUARDS=1 )
12
12
13
+ target_link_options (enc_bootloader PUBLIC -Wl,--print-memory-usage )
14
+
15
+ target_include_directories (enc_bootloader PRIVATE ${CMAKE_CURRENT_LIST_DIR} )
16
+
13
17
# set as no_flash binary
14
18
pico_set_binary_type (enc_bootloader no_flash )
15
19
@@ -35,8 +39,8 @@ function(add_linker_script target origin length)
35
39
pico_set_linker_script (${target} ${CMAKE_CURRENT_BINARY_DIR} /${target}.ld )
36
40
endfunction ()
37
41
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 " )
40
44
41
45
# sign, hash, and clear SRAM
42
46
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)
50
54
pico_set_uf2_family (enc_bootloader "absolute" )
51
55
pico_package_uf2_output (enc_bootloader 0x10000000 )
52
56
57
+ # optionally enable USB output in addition to UART
58
+ # pico_enable_stdio_usb(enc_bootloader 1)
59
+
53
60
# create map/bin/hex/uf2 file etc.
54
61
pico_add_extra_outputs (enc_bootloader )
55
62
@@ -83,6 +90,9 @@ pico_encrypt_binary(hello_serial_enc ${CMAKE_CURRENT_LIST_DIR}/privateaes.bin ${
83
90
# package uf2 in flash
84
91
pico_package_uf2_output (hello_serial_enc 0x10000000 )
85
92
93
+ # optionally enable USB output in addition to UART
94
+ # pico_enable_stdio_usb(hello_serial_enc 1)
95
+
86
96
# create map/bin/hex/uf2 file etc.
87
97
pico_add_extra_outputs (hello_serial_enc )
88
98
0 commit comments