Skip to content

Commit

Permalink
Merge pull request #79 from fabianpedd/fabianpedd-minor-v-ext-fix
Browse files Browse the repository at this point in the history
Remove segment extraction from cmake
  • Loading branch information
Rafael Stahl authored Sep 17, 2021
2 parents cce8640 + 7ec4c8a commit c2d04fd
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions examples/SW/riscv/cmake/PulpinoTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ MACRO(ADD_EXECUTABLE_PULPINO_INTERNAL TARGET_NAME ADD_PLATFORM_FILES)
IF(NOT PULPINO_STACK_SIZE)
SET(PULPINO_STACK_SIZE 0x4000)
ENDIF()
IF(NOT PULPINO_HEAP_SIZE)
SET(PULPINO_HEAP_SIZE 0x4000)
ENDIF()
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
-Xlinker --defsym=PULPINO_ROM_START=${PULPINO_ROM_START} \
-Xlinker --defsym=PULPINO_ROM_SIZE=${PULPINO_ROM_SIZE} \
Expand Down Expand Up @@ -101,30 +104,7 @@ MACRO(ADD_EXECUTABLE_PULPINO_INTERNAL TARGET_NAME ADD_PLATFORM_FILES)
PULPINO_SETTINGS_POST(${TARGET_NAME})

SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES LINK_DEPENDS ${PULPINO_LIB_TUMEDA}/link.ld)
IF(NOT CMAKE_OBJCOPY)
# CMake does not set this on first invocation, because the toolchain file is included
# in the CMakeLists.txt when it should be given as cmdline argument.
STRING(REGEX REPLACE "gcc$" "objcopy" CMAKE_OBJCOPY ${CMAKE_C_COMPILER})
ENDIF()
IF(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
SET(DD_CMD ${PULPINO_TOOLCHAIN_DIR}/../../../../bin/copy_binary.exe)
ELSE()
SET(DD_CMD dd)
ENDIF()
ADD_CUSTOM_COMMAND(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_OBJCOPY}
ARGS -O binary ${TARGET_NAME} ${TARGET_NAME}.bin
COMMAND ${DD_CMD}
ARGS bs=1 count=${DD_ARG_SKIP} if=${TARGET_NAME}.bin of=${TARGET_NAME}.rom
COMMAND ${DD_CMD}
ARGS bs=1 skip=${DD_ARG_SKIP} if=${TARGET_NAME}.bin of=${TARGET_NAME}.ram
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
SET_PROPERTY(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
"${TARGET_NAME}.bin"
"${TARGET_NAME}.ram"
"${TARGET_NAME}.rom"
)

ENDMACRO()

MACRO(ADD_EXECUTABLE_PULPINO TARGET_NAME)
Expand Down

0 comments on commit c2d04fd

Please sign in to comment.