Skip to content

Commit 2f3d737

Browse files
authored
Merge pull request #1438 from NickeZ/nickez/da14531-squashed
Nickez/da14531 squashed
2 parents 9048391 + 61e53b9 commit 2f3d737

File tree

93 files changed

+4789
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+4789
-220
lines changed

.ci/ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ make -j8 bootloader-btc
5555
make -j8 bootloader-btc-development
5656
make -j8 bootloader-btc-production
5757

58+
make -j8 bootloader-plus
59+
make -j8 bootloader-plus-development
60+
5861
# Firmware
5962
make -j8 firmware
6063
make -j8 firmware-btc

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
[submodule "external/optiga-trust-m"]
1414
path = external/optiga-trust-m
1515
url = https://github.com/BitBoxSwiss/optiga-trust-m.git
16+
[submodule "external/embedded-swd"]
17+
path = external/embedded-swd
18+
url = https://github.com/BitBoxSwiss/embedded-swd

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ elseif(CCACHE_PROGRAM)
4444
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
4545
endif()
4646

47+
# This is ignored on platforms other than darwin. By default rust compiles for
48+
# 10.7 which doesn't link for us.
49+
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
50+
4751
project(bitbox02 C)
4852

4953
# nosys is set in arm.cmake so that `project(c)` above works. Remove it since it interferes with compile options
@@ -324,7 +328,7 @@ string(APPEND CMAKE_C_FLAGS " -Wno-cast-function-type")
324328

325329
# Enable stack protection on release builds
326330
if(NOT CMAKE_BUILD_TYPE STREQUAL "DEBUG")
327-
string(APPEND CMAKE_C_FLAGS " -fstack-protector-all")
331+
string(APPEND CMAKE_C_FLAGS " -fstack-protector-strong")
328332
if(CMAKE_CROSSCOMPILING)
329333
# Path to empty dummy libssp and libssp_shared. '-llibssp -llibssp_shared' is automatically added
330334
# with '-fstack-protector-all', but we don't need them as we have our own custom

Makefile

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,23 @@ firmware-btc: | build
6464
firmware-debug: | build-debug
6565
$(MAKE) -C build-debug firmware.elf
6666
bootloader: | build
67-
$(MAKE) -C build bootloader.elf
67+
$(MAKE) -C build bb02-bl-multi.elf
6868
bootloader-development: | build
69-
$(MAKE) -C build bootloader-development.elf
69+
$(MAKE) -C build bb02-bl-multi-development.elf
70+
bootloader-plus: | build
71+
$(MAKE) -C build bb02p-bl-multi.elf
72+
bootloader-plus-development: | build
73+
$(MAKE) -C build bb02p-bl-multi-development.elf
7074
bootloader-development-locked: | build
71-
$(MAKE) -C build bootloader-development-locked.elf
75+
$(MAKE) -C build bb02-bl-multi-development-locked.elf
7276
bootloader-production: | build
73-
$(MAKE) -C build bootloader-production.elf
77+
$(MAKE) -C build bb02-bl-multi-production.elf
7478
bootloader-btc: | build
75-
$(MAKE) -C build bootloader-btc.elf
79+
$(MAKE) -C build bb02-bl-btconly.elf
7680
bootloader-btc-development: | build
77-
$(MAKE) -C build bootloader-btc-development.elf
81+
$(MAKE) -C build bb02-bl-btconly-development.elf
7882
bootloader-btc-production: | build
79-
$(MAKE) -C build bootloader-btc-production.elf
83+
$(MAKE) -C build bb02-bl-btconly-production.elf
8084
factory-setup: | build
8185
$(MAKE) -C build factory-setup.elf
8286
docs: | build
@@ -106,15 +110,17 @@ run-valgrind-on-unit-tests:
106110
flash-dev-firmware:
107111
./py/load_firmware.py build/bin/firmware.bin --debug
108112
jlink-flash-bootloader-development: | build
109-
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bootloader-development.jlink
113+
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-multi-development.jlink
114+
jlink-flash-bootloader-plus-development: | build
115+
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02p-bl-multi-development.jlink
110116
jlink-flash-bootloader-development-locked: | build
111-
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bootloader-development-locked.jlink
117+
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-multi-development-locked.jlink
112118
jlink-flash-bootloader: | build
113-
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bootloader.jlink
119+
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-multi.jlink
114120
jlink-flash-bootloader-btc-development: | build
115-
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bootloader-btc-development.jlink
121+
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-btc-development.jlink
116122
jlink-flash-bootloader-btc: | build
117-
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bootloader-btc.jlink
123+
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-btc.jlink
118124
jlink-flash-firmware: | build
119125
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/firmware.jlink
120126
jlink-flash-firmware-btc: | build
@@ -133,12 +139,16 @@ jlink-flash-set-securechip-optiga:
133139
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/set-securechip-optiga.jlink
134140
jlink-flash-set-bb02plus:
135141
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/set-bb02plus.jlink
142+
jlink-erase-firmware-quick:
143+
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/erase-firmware-quick.jlink
136144
jlink-gdb-server:
137145
JLinkGDBServer -nogui -if SWD -device ATSAMD51J20 -speed 4000
138146
rtt-client:
139147
telnet localhost 19021
140148
run-debug:
141149
arm-none-eabi-gdb -x scripts/jlink.gdb build-debug/bin/firmware.elf
150+
run-bootloader:
151+
arm-none-eabi-gdb -x scripts/jlink-bootloader.gdb build/bin/bb02p-bl-multi-development.elf
142152
dockerinit:
143153
./scripts/container.sh build --pull --force-rm --no-cache -t shiftcrypto/firmware_v2:$(shell cat .containerversion) .
144154
dockerpull:

bitbox-da14531-firmware.o

24.4 KB
Binary file not shown.

cmake/modules/FindCMocka.cmake

Lines changed: 0 additions & 13 deletions
This file was deleted.

external/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ set(LIBWALLY_CFLAGS "\
3232
-D_DEFAULT_SOURCE \
3333
-fno-strict-aliasing \
3434
")
35+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
36+
string(APPEND LIBWALLY_CFLAGS " -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
37+
endif()
3538

3639
# Hide some warnings
3740
set(LIBWALLY_CFLAGS "${LIBWALLY_CFLAGS} -Wno-cast-qual -Wno-cast-align \
@@ -113,6 +116,8 @@ if(CMAKE_CROSSCOMPILING)
113116
asf4-drivers/hal/src/hal_io.c
114117
asf4-drivers/hal/src/hal_sha_sync.c
115118
asf4-drivers/hpl/systick/hpl_systick.c
119+
asf4-drivers/hal/src/hal_usart_async.c
120+
asf4-drivers/hal/utils/src/utils_ringbuffer.c
116121
asf4-drivers/hpl/gclk/hpl_gclk.c
117122
asf4-drivers/hpl/oscctrl/hpl_oscctrl.c
118123
asf4-drivers/hpl/mclk/hpl_mclk.c
@@ -139,6 +144,8 @@ if(CMAKE_CROSSCOMPILING)
139144

140145
target_link_libraries(asf4-drivers-min samd51a-ds)
141146
set_property(TARGET asf4-drivers-min PROPERTY INTERFACE_LINK_LIBRARIES "")
147+
target_compile_options(asf4-drivers-min PRIVATE -Wno-cast-qual
148+
-Wno-unused-parameter -Wno-missing-prototypes -Wno-missing-declarations)
142149

143150
target_include_directories(asf4-drivers-min SYSTEM
144151
PUBLIC
@@ -237,6 +244,22 @@ set_property(TARGET asf4-drivers PROPERTY INTERFACE_LINK_LIBRARIES "")
237244
-Wno-pedantic -Wno-incompatible-pointer-types -Wno-unused-parameter -Wno-unused-variable -Wno-cast-qual
238245
-Wno-switch-default -Wno-format-nonliteral -Wno-missing-prototypes -Wno-missing-declarations
239246
)
247+
add_library(embedded-swd
248+
embedded-swd/dap.c
249+
embedded-swd/dap_target.c
250+
)
251+
target_include_directories(embedded-swd SYSTEM PUBLIC
252+
embedded-swd
253+
)
254+
target_link_libraries(embedded-swd
255+
PRIVATE
256+
CMSIS
257+
)
258+
target_link_libraries(embedded-swd
259+
PUBLIC
260+
samd51a-ds
261+
)
262+
240263
endif() # CMAKE_CROSSCOMPILING
241264

242265
# fatfs must to be linked together with a diskio middleware:

0 commit comments

Comments
 (0)