Skip to content

Commit

Permalink
Fix multifw build for adlib
Browse files Browse the repository at this point in the history
  • Loading branch information
polpo committed Jul 6, 2024
1 parent fb46bb3 commit 193ab73
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 156 deletions.
47 changes: 0 additions & 47 deletions multifw/uf2.h

This file was deleted.

95 changes: 0 additions & 95 deletions multifw/uf2create.c

This file was deleted.

29 changes: 17 additions & 12 deletions sw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,11 @@ if(PROJECT_TYPE STREQUAL "MULTIFW")
OUTPUT
"${CMAKE_BINARY_DIR}/generated/multifw/flash_firmware.h"
"${CMAKE_BINARY_DIR}/pg-gus-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-sb-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-adlib-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-mpu-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-tandy-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-cms-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-sb-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-usb-multifw.ld"
COMMAND
${CMAKE_COMMAND}
Expand All @@ -328,42 +329,43 @@ if(PROJECT_TYPE STREQUAL "MULTIFW")
-DFW_LD_IN="${CMAKE_SOURCE_DIR}/multifw/firmware.ld.in"
-DFW_1_BIN="${CMAKE_BINARY_DIR}/pg-gus.bin"
-DFW_1_LD="${CMAKE_BINARY_DIR}/pg-gus-multifw.ld"
-DFW_2_BIN="${CMAKE_BINARY_DIR}/pg-sb.bin"
-DFW_2_LD="${CMAKE_BINARY_DIR}/pg-sb-multifw.ld"
-DFW_2_BIN="${CMAKE_BINARY_DIR}/pg-adlib.bin"
-DFW_2_LD="${CMAKE_BINARY_DIR}/pg-adlib-multifw.ld"
-DFW_3_BIN="${CMAKE_BINARY_DIR}/pg-mpu.bin"
-DFW_3_LD="${CMAKE_BINARY_DIR}/pg-mpu-multifw.ld"
-DFW_4_BIN="${CMAKE_BINARY_DIR}/pg-tandy.bin"
-DFW_4_LD="${CMAKE_BINARY_DIR}/pg-tandy-multifw.ld"
-DFW_5_BIN="${CMAKE_BINARY_DIR}/pg-cms.bin"
-DFW_5_LD="${CMAKE_BINARY_DIR}/pg-cms-multifw.ld"
-DFW_6_BIN="${CMAKE_BINARY_DIR}/pg-usb.bin"
-DFW_6_LD="${CMAKE_BINARY_DIR}/pg-usb-multifw.ld"
-DFW_6_BIN="${CMAKE_BINARY_DIR}/pg-sb.bin"
-DFW_6_LD="${CMAKE_BINARY_DIR}/pg-sb-multifw.ld"
-DFW_7_BIN="${CMAKE_BINARY_DIR}/pg-usb.bin"
-DFW_7_LD="${CMAKE_BINARY_DIR}/pg-usb-multifw.ld"
-P ${CMAKE_SOURCE_DIR}/multifw/generate_ld.cmake
DEPENDS
"${CMAKE_SOURCE_DIR}/multifw/firmware.ld.in"
pg-gus
pg-sb
pg-adlib
pg-mpu
pg-tandy
pg-cms
pg-sb
pg-usb
)
add_custom_target(generate_flash_firmware_h DEPENDS
"${CMAKE_BINARY_DIR}/generated/multifw/flash_firmware.h"
"${CMAKE_BINARY_DIR}/pg-gus-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-sb-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-adlib-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-mpu-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-tandy-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-cms-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-sb-multifw.ld"
"${CMAKE_BINARY_DIR}/pg-usb-multifw.ld"
)

build_gus(pg-gus FALSE)
build_gus(pg-gus-multifw TRUE)
add_dependencies(pg-gus-multifw pg-gus generate_flash_firmware_h)
build_sb(pg-sb FALSE)
build_sb(pg-sb-multifw TRUE)
add_dependencies(pg-sb-multifw pg-sb generate_flash_firmware_h)
build_adlib(pg-adlib FALSE)
build_adlib(pg-adlib-multifw TRUE)
add_dependencies(pg-adlib-multifw pg-adlib generate_flash_firmware_h)
Expand All @@ -376,6 +378,9 @@ if(PROJECT_TYPE STREQUAL "MULTIFW")
build_cms(pg-cms FALSE)
build_cms(pg-cms-multifw TRUE)
add_dependencies(pg-cms-multifw pg-cms generate_flash_firmware_h)
build_sb(pg-sb FALSE)
build_sb(pg-sb-multifw TRUE)
add_dependencies(pg-sb-multifw pg-sb generate_flash_firmware_h)
build_usb(pg-usb FALSE)
build_usb(pg-usb-multifw TRUE)
add_dependencies(pg-usb-multifw pg-usb generate_flash_firmware_h)
Expand All @@ -400,8 +405,8 @@ if(PROJECT_TYPE STREQUAL "MULTIFW")
endif()
add_custom_command(
OUTPUT picogus.uf2
DEPENDS bootloader pg-gus-multifw pg-sb-multifw pg-mpu-multifw pg-tandy-multifw pg-cms-multifw pg-usb-multifw
COMMAND UF2CREATE bootloader.bin pg-gus-multifw.bin pg-sb-multifw.bin pg-mpu-multifw.bin pg-tandy-multifw.bin pg-cms-multifw.bin pg-usb-multifw.bin picogus.uf2
DEPENDS bootloader UF2CREATE pg-gus-multifw pg-adlib-multifw pg-mpu-multifw pg-tandy-multifw pg-cms-multifw pg-sb-multifw pg-usb-multifw
COMMAND UF2CREATE bootloader.bin pg-gus-multifw.bin pg-adlib-multifw.bin pg-mpu-multifw.bin pg-tandy-multifw.bin pg-cms-multifw.bin pg-sb-multifw.bin pg-usb-multifw.bin picogus.uf2
)
add_custom_target(picogus ALL DEPENDS picogus.uf2)

Expand Down
3 changes: 2 additions & 1 deletion sw/multifw/flash_firmware.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
// Make sure the FLASH addresses match the .ld files!!!
// ld files for picogus firmwares/modes are based on memmap_copy_to_ram.ld as they run with set(PICO_COPY_TO_RAM 1)

#define NR_OF_FIRMWARES 6
#define NR_OF_FIRMWARES 7
#define FLASH_FIRMWARE1 ${FW_1_ORIGIN}
#define FLASH_FIRMWARE2 ${FW_2_ORIGIN}
#define FLASH_FIRMWARE3 ${FW_3_ORIGIN}
#define FLASH_FIRMWARE4 ${FW_4_ORIGIN}
#define FLASH_FIRMWARE5 ${FW_5_ORIGIN}
#define FLASH_FIRMWARE6 ${FW_6_ORIGIN}
#define FLASH_FIRMWARE7 ${FW_7_ORIGIN}
2 changes: 2 additions & 0 deletions sw/multifw/generate_ld.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ generate_ld_file(${FW_3_BIN} ${FW_3_LD})
generate_ld_file(${FW_4_BIN} ${FW_4_LD})
generate_ld_file(${FW_5_BIN} ${FW_5_LD})
generate_ld_file(${FW_6_BIN} ${FW_6_LD})
generate_ld_file(${FW_7_BIN} ${FW_7_LD})
list(GET FW_ORIGINS 0 FW_1_ORIGIN)
list(GET FW_ORIGINS 1 FW_2_ORIGIN)
list(GET FW_ORIGINS 2 FW_3_ORIGIN)
list(GET FW_ORIGINS 3 FW_4_ORIGIN)
list(GET FW_ORIGINS 4 FW_5_ORIGIN)
list(GET FW_ORIGINS 5 FW_6_ORIGIN)
list(GET FW_ORIGINS 6 FW_7_ORIGIN)

file(REMOVE ${FLASH_FIRMWARE_H})
configure_file(${FLASH_FIRMWARE_H_IN} ${FLASH_FIRMWARE_H})
2 changes: 1 addition & 1 deletion sw/multifw/uf2create/uf2create.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main(int argc, char *argv[])
{
int total_size = 0;
static uint8_t flashbuffer[FLASH_SIZE];
uint32_t offset[INPUT_FILES] = {0, FLASH_FIRMWARE1, FLASH_FIRMWARE2, FLASH_FIRMWARE3, FLASH_FIRMWARE4, FLASH_FIRMWARE5, FLASH_FIRMWARE6};
uint32_t offset[INPUT_FILES] = {0, FLASH_FIRMWARE1, FLASH_FIRMWARE2, FLASH_FIRMWARE3, FLASH_FIRMWARE4, FLASH_FIRMWARE5, FLASH_FIRMWARE6, FLASH_FIRMWARE7};
struct uf2_block uf2;

FILE *f_input, *f_output;
Expand Down

0 comments on commit 193ab73

Please sign in to comment.