-
HC32L130 GCC编译的hex文件下载无反应
由于版权问题,不能用keil。官方的例程中没有GCC的启动文件和ld文件,从论坛中下载了一份。成功生成hex文件并下载成功,但没反应。不晓得是不是生成hex文件的问题。附上cmakeset(CMAKE_SYSTEM_NAMEGeneric)cmake_minimum_required(VERSION3.21)project(HC32L130CASM)set(CMAKE_C_COMPILERarm-none-eabi-gcc)set(CMAKE_CXX_COMPILERarm-none-eabi-g++)set(CMAKE_ASM_COMPILERarm-none-eabi-gcc)set(CMAKE_C_FLAGS_DEBUG"-O0-g2-ggdb")set(CMAKE_C_FLAGS_RELEASE"-O0")set(CMAKE_CXX_STANDARD17)set(CMAKE_C_STANDARD99)include_directories(CMSIS/IncComponents/BSP/IncDriver/Inc${CMAKE_CURRENT_BINARY_DIR})file(GLOB_RECURSEhc32l130libCONFIGURE_DEPENDSCMSIS/Src/*.cDriver/Src/*.c)file(GLOB_RECURSEbspCONFIGURE_DEPENDSComponents/BSP/Src)aux_source_directory(${CMAKE_SOURCE_DIR}/mainmain)set(startup${CMAKE_SOURCE_DIR}/startup_hc32L13x.S)set(LINKER_SCRIPT${CMAKE_SOURCE_DIR}/HC32L130.ld)set(MAP_FILE${PROJECT_NAME}.map)set(CMAKE_C_FLAGS"-mlong-calls-fno-common-mcpu=cortex-m0plus-mthumb-ffunction-sections-fdata-sections")set(CMAKE_EXE_LINKER_FLAGS"-mcpu=cortex-m0plus-mthumb-ffunction-sections-T${LINKER_SCRIPT}-Xlinker--gc-sections-Wl,-Map,${MAP_FILE}--specs=nano.specs--specs=nosys.specs")set(CMAKE_EXE_LINKER_FLAGS_INIT"-mcpu=cortex-m0plus-mthumb-nostartfiles-ffunction-sections-Xlinker--gc-sections--specs=nano.specs--specs=nosys.specs--print-memory-usage")set(HEX_FILE${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex)add_executable(${PROJECT_NAME}.elf${main}${hc32l130lib}${bsp}${startup}${LINKER_SCRIPT})add_custom_command(TARGET${PROJECT_NAME}.elfPOST_BUILDCOMMAND${CMAKE_OBJCOPY}-Oihex$${HEX_FILE}COMMENT"Building${HEX_FILE}")
2024-02-23 7