Skip to content

Commit 8b6f3f6

Browse files
committed
build: New make target bootloader-debug
A new make target for developing without screen or developing on the bootloader itself. Always jumps to firmware and has RTT enabled.
1 parent 4481dbf commit 8b6f3f6

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ if(CMAKE_CROSSCOMPILING)
8585
message(STATUS "size: ${CMAKE_SIZE} ${TOOLCHAIN_PREFIX}size")
8686
endif()
8787

88+
option(BOOTLOADER_NO_MENU "Build a bootloader that always boots" OFF)
89+
8890

8991
#-----------------------------------------------------------------------------
9092
# Create version header file

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ build/Makefile:
2828

2929
build-debug/Makefile:
3030
mkdir -p build-debug
31-
cd build-debug && cmake -DCMAKE_TOOLCHAIN_FILE=arm.cmake -DCMAKE_BUILD_TYPE=DEBUG ..
31+
cd build-debug && cmake -DCMAKE_TOOLCHAIN_FILE=arm.cmake -DCMAKE_BUILD_TYPE=DEBUG -DBOOTLOADER_NO_MENU=1 ..
3232
$(MAKE) -C py/bitbox02
3333

3434
build-build/Makefile:
@@ -77,6 +77,9 @@ bootloader-btc-development: | build
7777
$(MAKE) -C build bootloader-btc-development.elf
7878
bootloader-btc-production: | build
7979
$(MAKE) -C build bootloader-btc-production.elf
80+
# The debug bootloader doesn't have a menu, and always boots. Use gdb/RTT
81+
bootloader-debug: | build-debug
82+
$(MAKE) -C build-debug bootloader.elf
8083
factory-setup: | build
8184
$(MAKE) -C build factory-setup.elf
8285
docs: | build

src/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@ if(CMAKE_CROSSCOMPILING)
435435
target_link_libraries(${elf} PRIVATE --specs=nano.specs)
436436
target_compile_options(${elf} PRIVATE --specs=nosys.specs)
437437
target_link_libraries(${elf} PRIVATE --specs=nosys.specs)
438+
439+
if(BOOTLOADER_NO_MENU)
440+
target_compile_definitions(${elf} PRIVATE BOOTLOADER_NO_MENU)
441+
endif()
438442
endforeach(bootloader)
439443

440444
foreach(bootloader ${DEVDEVICE-BOOTLOADERS})

src/bootloader/bootloader.c

+6
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,12 @@ void bootloader_jump(void)
963963

964964
_check_init(&bootdata);
965965

966+
#if defined(BOOTLOADER_NO_MENU)
967+
if (((uint32_t*)FLASH_APP_START)[1] != 0xffffffff) {
968+
_binary_exec(); /* no return */
969+
}
970+
#endif
971+
966972
#if PLATFORM_BITBOX02 == 1
967973
if (shared_data.fields.upside_down) {
968974
screen_rotate();

0 commit comments

Comments
 (0)