Browse Source

CMakeLists.txt: fix dependencies to allow make -j

As ${APP_BIN} and ${APP_HDR_BIN} are not true targets, the dependency on them
effectively only required the .bin files to be present.

When building with make -j, this led to the situation that the target
${NAME}_hdr finished *before* compiling the project, in case there were .bin
files left from previous builds, leading to ${NAME}_hdr.bin files containing
invalid CRCs.

Setting the dependencies on ${NAME} fixes this issue. The reasoning is that if
target ${NAME} is built, ${APP_BIN} should have been generated. There is no
need to depend on both ${NAME} and ${NAME}_hdr, as ${NAME}_hdr already depends
on ${NAME}.
Maarten van der Schrieck 1 year ago
parent
commit
9c4efdd40e
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      CMakeLists.txt

+ 4
- 4
CMakeLists.txt View File

@@ -137,14 +137,14 @@ function(picowota_build_combined NAME)
137 137
 	pico_set_linker_script(picowota ${PICOWOTA_SRC_DIR}/bootloader_shell.ld)
138 138
 
139 139
 	# TODO: The hard-coded address here is a bit nasty
140
-	add_custom_target(${NAME}_hdr DEPENDS ${APP_BIN})
141
-	add_custom_command(TARGET ${NAME}_hdr DEPENDS ${APP_BIN}
140
+	add_custom_target(${NAME}_hdr DEPENDS ${NAME})
141
+	add_custom_command(TARGET ${NAME}_hdr DEPENDS ${NAME}
142 142
 		COMMAND ${PICOWOTA_SRC_DIR}/gen_imghdr.py -a 0x1005B000 ${APP_BIN} ${APP_HDR_BIN}
143 143
 	)
144 144
 
145 145
 	add_custom_target(${COMBINED} ALL)
146
-	add_dependencies(${COMBINED} picowota ${NAME}_hdr ${NAME})
147
-	add_custom_command(TARGET ${COMBINED} DEPENDS ${APP_HDR_BIN} ${APP_BIN}
146
+	add_dependencies(${COMBINED} picowota ${NAME}_hdr)
147
+	add_custom_command(TARGET ${COMBINED} DEPENDS ${NAME}_hdr
148 148
 		COMMAND ${CMAKE_OBJCOPY}
149 149
 			--update-section .app_hdr=${APP_HDR_BIN}
150 150
 			--update-section .app_bin=${APP_BIN} ${PICOWOTA_BIN_DIR}/picowota.elf ${COMBINED}.elf

Loading…
Cancel
Save