diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt deleted file mode 100644 index 1fc15d7..0000000 --- a/firmware/CMakeLists.txt +++ /dev/null @@ -1,203 +0,0 @@ -cmake_minimum_required(VERSION 3.17) -set(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_SYSTEM_VERSION 1) -# Disable linking with the standard C library (libc) -set(CMAKE_EXE_LINKER_FLAGS "-nostdlib") -set(CMAKE_C_FLAGS "-nostdlib") -set(CMAKE_CXX_FLAGS "-nostdlib") -# Define the base toolchain path -set(TOOLCHAIN "../../compiler/gcc-arm-none-eabi-4_9-2015q1/bin") - -# Set the compilers and tools using the TOOLCHAIN variable -set(CMAKE_C_COMPILER "${TOOLCHAIN}/arm-none-eabi-gcc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN}/arm-none-eabi-g++") -set(CMAKE_ASM_COMPILER "${TOOLCHAIN}/arm-none-eabi-gcc") -set(CMAKE_AR "${TOOLCHAIN}/arm-none-eabi-ar") -set(CMAKE_OBJCOPY "${TOOLCHAIN}/arm-none-eabi-objcopy") -set(CMAKE_OBJDUMP "${TOOLCHAIN}/arm-none-eabi-objdump") -set(SIZE "${TOOLCHAIN}/arm-none-eabi-size") -set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) - -project(nando_fw C ASM) -#set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") - - -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_C_STANDARD 11) - -# Toolchain and directories -set(BOOT_DIR bootloader) -set(APP_DIR programmer) -set(GEN_NAME nando_fw) - -set(BOOT_PROG bootloader_fw) -set(APP_FW_1_PROG app_fw_1) -set(APP_FW_2_PROG app_fw_2) - -set(MCPU cortex-m3) - -# Flags -set(CFLAGS -g -Wall -Werror -Og) - -# Common compile options -add_compile_options(-DSTM32F10X_HD -DCONFIG_BOOTLOADER ${CFLAGS}) -add_compile_options(-mcpu=${MCPU} -mthumb -mthumb-interwork -MMD -MP) -add_compile_options(-ffunction-sections -fdata-sections) - -# Uncomment for hardware floating point -# add_compile_definitions(ARM_MATH_CM3;ARM_MATH_MATRIX_CHECK;ARM_MATH_ROUNDING) -# add_compile_options(-mfloat-abi=hard -mfpu=fpv4-sp-d16) -# add_link_options(-mfloat-abi=hard -mfpu=fpv4-sp-d16) - - -# Uncomment for software floating point -# add_compile_options(-mfloat-abi=soft) - -if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - message(STATUS "Maximum optimization for speed") - add_compile_options(-Ofast) -elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") - message(STATUS "Maximum optimization for speed, debug info included") - add_compile_options(-Ofast -g) -elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") - message(STATUS "Maximum optimization for size") - add_compile_options(-Os) -else () - message(STATUS "Minimal optimization, debug info included") - add_compile_options(-Og -g) -endif () - -# Set the library path for SPL (Standard Peripheral Library) -set(LIB_DIR "${CMAKE_SOURCE_DIR}/libs") - -# Define the paths for SPL headers and configuration file -set(SPL_PATH "${LIB_DIR}/spl") -set(SPL_DEVICE_SUPPORT_PATH "${SPL_PATH}/CMSIS/CM3/DeviceSupport/ST/STM32F10x") -set(SPL_CORE_SUPPORT "${SPL_PATH}/CMSIS/CM3/CoreSupport") -set(SPL_PERIPH_PATH "${SPL_PATH}/STM32F10x_StdPeriph_Driver") -set(SPL_USB_PATH "${SPL_PATH}/STM32_USB-FS-Device_Driver") -set(SPL_CONFIG_FILE "${SPL_PATH}/stm32f10x_conf.h") - -# Additional include directories -set(INCLUDE_DIR "${CMAKE_SOURCE_DIR}") -set(USB_DIR "${CMAKE_SOURCE_DIR}/usb_cdc") - -# Add all necessary include directories -include_directories( - ${SPL_PATH} - ${SPL_CORE_SUPPORT} # SPL Core support headers - ${SPL_DEVICE_SUPPORT_PATH} # Device support headers (STM32F10x) - ${SPL_PERIPH_PATH}/inc # Peripheral driver headers - ${SPL_USB_PATH}/inc # USB driver headers - ${USB_DIR} # USB CDC directory -) - -add_definitions(-include ${SPL_CONFIG_FILE}) -# Define preprocessor macros for STM32F103VC-based project -add_definitions( - -DUSE_HAL_DRIVER # Enable STM32 HAL support - -DSTM32F103xx # Target STM32F103 series (includes STM32F103VC) - -DCORE_CM3 # Targeting ARM Cortex-M3 core - -DDEBUG # Optional: Enable debugging code (use in #ifdef DEBUG) -) - - -# Define the library name -set(SPL_LIB stm32f10x) - -file(GLOB_RECURSE LIB_SRCS - ${SPL_PATH}/*.c - ) - - - -# Specify the static library to be built -add_library(${SPL_LIB} STATIC ${LIB_SRCS} ${SPL_PATH}/startup_stm32f10x_hd.s) -target_compile_options(${SPL_LIB} PRIVATE -ffreestanding -nostdlib) - -# Define linker scripts -set(LINKER_SCRIPT_BOOT ${CMAKE_SOURCE_DIR}/${BOOT_DIR}/stm32_flash.ld) -set(LINKER_SCRIPT_1 ${CMAKE_SOURCE_DIR}/${APP_DIR}/stm32_flash_1.ld) -set(LINKER_SCRIPT_2 ${CMAKE_SOURCE_DIR}/${APP_DIR}/stm32_flash_2.ld) - - -add_link_options(-Wl,-gc-sections,-Map=${CMAKE_BINARY_DIR}/${PROJECT_NAME}.map) -add_link_options(-mcpu=${MCPU} -mthumb -mthumb-interwork) -# -# Build bootloader -file(GLOB_RECURSE BOOTLOADER_SOURCES ${BOOT_DIR}/*.c) -add_executable(${BOOT_PROG}.elf ${BOOTLOADER_SOURCES} ${SPL_PATH}/init.c) -target_link_libraries(${BOOT_PROG}.elf PRIVATE -T${LINKER_SCRIPT_BOOT} ${SPL_LIB}) -add_custom_command(TARGET ${BOOT_PROG}.elf POST_BUILD - COMMAND ${CMAKE_OBJCOPY} --pad-to 0x08004000 -O ihex $ ${CMAKE_BINARY_DIR}/${BOOT_PROG}.hex - COMMAND ${CMAKE_OBJCOPY} -O binary $ ${CMAKE_BINARY_DIR}/${BOOT_PROG}.bin - COMMAND ${CMAKE_OBJDUMP} -St $ > ${CMAKE_BINARY_DIR}/${BOOT_PROG}.lst - COMMAND ${SIZE} $ - COMMENT "Building ${BOOT_PROG}.hex -Building ${BOOT_PROG}.bin -Generating list file and displaying size" - ) - -# Build app1 -file(GLOB_RECURSE APP1_SOURCES ${APP_DIR}/*.c ${USB_DIR}/*.c) - -add_executable(${APP_FW_1_PROG}.elf ${APP1_SOURCES} ${SPL_PATH}/init.c) -target_link_libraries(${APP_FW_1_PROG}.elf PRIVATE -T ${LINKER_SCRIPT_1} ${SPL_LIB}) - - -add_custom_command(TARGET ${APP_FW_1_PROG}.elf POST_BUILD - COMMAND ${CMAKE_OBJCOPY} --pad-to 0x08022000 -O ihex $ ${CMAKE_BINARY_DIR}/${APP_FW_1_PROG}.hex - COMMAND ${CMAKE_OBJCOPY} -O binary $ ${CMAKE_BINARY_DIR}/${APP_FW_1_PROG}.bin - COMMAND ${CMAKE_OBJDUMP} -St $ > ${CMAKE_BINARY_DIR}/${APP_FW_1_PROG}.lst - COMMAND ${SIZE} $ - COMMENT "Building ${HEX_FILE_1} -Building ${BIN_FILE_1} -Generating list file and displaying size" - ) - -# Build app2 -add_executable(${APP_FW_2_PROG}.elf ${APP1_SOURCES} ${SPL_PATH}/init.c) -target_link_libraries(${APP_FW_2_PROG}.elf PRIVATE -T ${LINKER_SCRIPT_2} ${SPL_LIB}) - -add_custom_command(TARGET ${APP_FW_2_PROG}.elf POST_BUILD - COMMAND ${CMAKE_OBJCOPY} --pad-to 0x8003800 -O ihex $ ${CMAKE_BINARY_DIR}/${APP_FW_2_PROG}.hex - COMMAND ${CMAKE_OBJCOPY} -O binary $ ${CMAKE_BINARY_DIR}/${APP_FW_2_PROG}.bin - COMMAND ${CMAKE_OBJDUMP} -St $ > ${CMAKE_BINARY_DIR}/${APP_FW_2_PROG}.lst - COMMAND ${SIZE} $ - COMMENT "Building ${HEX_FILE_2} -Building ${BIN_FILE_2} -Generating list file and displaying size" - ) -add_custom_target( - ${GEN_NAME} ALL - DEPENDS ${BOOT_PROG}.hex ${APP_FW_1_PROG}.hex ${APP_FW_2_PROG}.hex - COMMAND sed -i '' '$$d' ${BOOT_PROG}.hex - COMMAND sed -i '' '$$d' ${APP_FW_1_PROG}.hex - COMMAND cat ${BOOT_PROG}.hex ${APP_FW_1_PROG}.hex ${APP_FW_2_PROG}.hex > ${GEN_NAME}.hex - COMMAND ${CMAKE_OBJCOPY} -I ihex -O elf32-littlearm ${GEN_NAME}.hex ${GEN_NAME}.elf - COMMAND ${CMAKE_OBJCOPY} -I ihex -O binary ${GEN_NAME}.hex ${GEN_NAME}.bin - COMMAND ${SIZE} ${GEN_NAME}.elf - COMMENT "Combining HEX files into ${GEN_NAME}.hex and generating ${GEN_NAME}.bin and ${GEN_NAME}.elf" - ) - - -# Erase and program target -add_custom_target(erase - COMMAND st-flash erase - COMMENT "Erasing the flash memory" - ) - -add_custom_target(program - COMMAND st-flash write ${GEN_NAME}.bin 0x08000000 - COMMENT "Programming the flash memory" - ) - -# Clean all build artifacts -add_custom_target(clean_all - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean - COMMAND ${CMAKE_COMMAND} -E rm -rf - COMMENT "Cleaning all build artifacts" - ) -add_dependencies(${APP_FW_1_PROG}.elf ${BOOT_PROG}.elf) -add_dependencies(${APP_FW_2_PROG}.elf ${APP_FW_1_PROG}.elf) -add_dependencies(${GEN_NAME} ${APP_FW_2_PROG}.elf) diff --git a/firmware/Makefile.linux b/firmware/Makefile.linux index fe69445..de3c8cd 100644 --- a/firmware/Makefile.linux +++ b/firmware/Makefile.linux @@ -19,49 +19,23 @@ APP2_PATH=$(APP_OBJ_DIR)$(APP2_NAME) OBJ_DIR=obj/ -COMPILER_BASE = $(shell realpath ../../compiler) -TOOLCHAIN=$(COMPILER_BASE)/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi- -CC=$(TOOLCHAIN)gcc +TOOLCHAIN=../../compiler/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi- OBJCOPY=$(TOOLCHAIN)objcopy -OBJDUMP=$(TOOLCHAIN)objdump -SIZE=$(TOOLCHAIN)size -AR=$(TOOLCHAIN)ar - -SPL_FLAGS=-DSTM32F10X_HD -DCONFIG_BOOTLOADER -CFLAGS=-g -Wall -Werror -O3 # Debugging flags: -g for debug symbols, -O0 for no optimization -CFLAGS+=-ffunction-sections -fdata-sections -CFLAGS+=-MMD -MP -CFLAGS+=-mcpu=cortex-m3 -mthumb -CFLAGS+=$(SPL_FLAGS) - -UNAME := $(shell uname) - all: - $(MAKE) -C $(BOOT_DIR) CC=$(CC) CFLAGS="$(CFLAGS)" OBJCOPY=$(OBJCOPY) OBJDUMP=$(OBJDUMP) SIZE=$(SIZE) AR=$(AR) - $(MAKE) -C $(APP_DIR) CC=$(CC) CFLAGS="$(CFLAGS)" OBJCOPY=$(OBJCOPY) OBJDUMP=$(OBJDUMP) SIZE=$(SIZE) AR=$(AR) - + $(MAKE) -C $(BOOT_DIR) + $(MAKE) -C $(APP_DIR) mkdir -p $(OBJ_DIR) cp $(BOOT_PATH) $(OBJ_DIR) cp $(APP1_PATH) $(OBJ_DIR) cp $(APP2_PATH) $(OBJ_DIR) -ifeq ($(UNAME), Darwin) - sed -i '' '$$d' $(OBJ_DIR)$(BOOT_NAME) - sed -i '' '$$d' $(OBJ_DIR)$(APP1_NAME) -else sed -i '$$d' $(OBJ_DIR)$(BOOT_NAME) sed -i '$$d' $(OBJ_DIR)$(APP1_NAME) -endif cat $(OBJ_DIR)$(BOOT_NAME) $(OBJ_DIR)$(APP1_NAME) \ $(OBJ_DIR)$(APP2_NAME) > $(OBJ_DIR)$(GEN_NAME).hex $(OBJCOPY) --input-target=ihex --output-target=binary \ $(OBJ_DIR)$(GEN_NAME).hex $(OBJ_DIR)$(GEN_NAME).bin - - $(OBJCOPY) -I ihex -O elf32-littlearm $(OBJ_DIR)$(GEN_NAME).hex $(OBJ_DIR)$(GEN_NAME).elf - # Show the size of the ELF file - $(SIZE) $(OBJ_DIR)$(GEN_NAME).elf -.PHONY: all clean clean: $(MAKE) -C $(BOOT_DIR) clean $(MAKE) -C $(APP_DIR) clean diff --git a/firmware/bootloader/Makefile.linux b/firmware/bootloader/Makefile.linux index 3b45f5d..df3f2de 100644 --- a/firmware/bootloader/Makefile.linux +++ b/firmware/bootloader/Makefile.linux @@ -7,6 +7,7 @@ PROG_NAME=bootloader_fw SRC_DIR=./ OBJ_DIR=obj/ LIB_DIR=../libs/ +TOOLCHAIN=../../../compiler/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi- PROG=$(OBJ_DIR)$(PROG_NAME) SPL_PATH=$(LIB_DIR)spl/ @@ -15,7 +16,12 @@ SPL_CORE_SUPPORT=$(SPL_PATH)CMSIS/CM3/CoreSupport/ SPL_PERIPH_PATH=$(SPL_PATH)STM32F10x_StdPeriph_Driver/ SPL_LIB=stm32f10x SPL_CONFIG_FILE=$(SPL_PATH)stm32f10x_conf.h +SPL_FLAGS=-DSTM32F10X_HD -DCONFIG_BOOTLOADER +CC=$(TOOLCHAIN)gcc +OBJCOPY=$(TOOLCHAIN)objcopy +OBJDUMP=$(TOOLCHAIN)objdump +SIZE=$(TOOLCHAIN)size INCLUDES=-include$(SPL_CONFIG_FILE) INCLUDES+=-I$(SPL_CORE_SUPPORT) @@ -24,16 +30,23 @@ INCLUDES+=-I$(SPL_PATH) INCLUDES+=-I$(SPL_PERIPH_PATH)inc INCLUDES+=-I$(SRC_DIR) +CFLAGS=-g -Wall -Werror -O3 +CFLAGS+=$(INCLUDES) -MMD -MP +CFLAGS+=-ffunction-sections -fdata-sections +CFLAGS+=-mcpu=cortex-m3 -mthumb +CFLAGS+=$(SPL_FLAGS) + LDFLAGS=-mcpu=cortex-m3 -mthumb -Wl,--gc-sections -Wl,-Map=$(PROG).map vpath %.c $(SRC_DIR) $(SPL_DEVICE_SUPPORT_PATH) $(SRC_BSP_DIR) vpath %.s $(SRC_DIR) -STARTUP=$(SPL_PATH)startup_stm32f10x_hd.s +STARTUP=startup_stm32f10x_hd.s SRCS=main.c system_stm32f10x.c syscalls.c uart.c -OBJS=$(addprefix $(OBJ_DIR),$(SRCS:.c=.o)) +OBJS=$(addprefix $(OBJ_DIR),$(SRCS:.c=.o)) \ + $(addprefix $(OBJ_DIR),$(STARTUP:.s=.o)) DEPS=$(OBJS:%.o=%.d) LINKER_SCRIPT=$(SRC_DIR)stm32_flash.ld @@ -41,7 +54,7 @@ LINKER_SCRIPT=$(SRC_DIR)stm32_flash.ld all: lib dirs $(PROG).elf lib: - $(MAKE) -C $(SPL_PATH) CC=$(CC) AR=$(AR) CFLAGS="$(CFLAGS)" + $(MAKE) -C $(SPL_PATH) dirs: mkdir -p $(OBJ_DIR) @@ -54,10 +67,10 @@ $(PROG).elf: $(OBJS) $(SIZE) $(PROG).elf $(OBJ_DIR)%.o: %.c - $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ + $(CC) -c $(CFLAGS) $< -o $@ $(OBJ_DIR)%.o: %.s - $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ + $(CC) -c $(CFLAGS) $< -o $@ -include $(DEPS) diff --git a/firmware/libs/spl/startup_stm32f10x_hd.s b/firmware/bootloader/startup_stm32f10x_hd.s similarity index 96% rename from firmware/libs/spl/startup_stm32f10x_hd.s rename to firmware/bootloader/startup_stm32f10x_hd.s index a93e59b..0aa9188 100644 --- a/firmware/libs/spl/startup_stm32f10x_hd.s +++ b/firmware/bootloader/startup_stm32f10x_hd.s @@ -1,469 +1,469 @@ -/** - ****************************************************************************** - * @file startup_stm32f10x_hd.s - * @author MCD Application Team - * @version V3.5.0 - * @date 11-March-2011 - * @brief STM32F10x High Density Devices vector table for Atollic toolchain. - * This module performs: - * - Set the initial SP - * - Set the initial PC == Reset_Handler, - * - Set the vector table entries with the exceptions ISR address, - * - Configure the clock system - * - Configure external SRAM mounted on STM3210E-EVAL board - * to be used as data memory (optional, to be enabled by user) - * - Branches to main in the C library (which eventually - * calls main()). - * After Reset the Cortex-M3 processor is in Thread mode, - * priority is Privileged, and the Stack is set to Main. - ****************************************************************************** - * @attention - * - * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS - * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE - * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY - * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING - * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE - * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. - * - *

© COPYRIGHT 2011 STMicroelectronics

- ****************************************************************************** - */ - - .syntax unified - .cpu cortex-m3 - .fpu softvfp - .thumb - -.global g_pfnVectors -.global Default_Handler - -/* start address for the initialization values of the .data section. -defined in linker script */ -.word _sidata -/* start address for the .data section. defined in linker script */ -.word _sdata -/* end address for the .data section. defined in linker script */ -.word _edata -/* start address for the .bss section. defined in linker script */ -.word _sbss -/* end address for the .bss section. defined in linker script */ -.word _ebss - -.equ BootRAM, 0xF1E0F85F -/** - * @brief This is the code that gets called when the processor first - * starts execution following a reset event. Only the absolutely - * necessary set is performed, after which the application - * supplied main() routine is called. - * @param None - * @retval : None -*/ - - .section .text.Reset_Handler - .weak Reset_Handler - .type Reset_Handler, %function -Reset_Handler: - -/* Copy the data segment initializers from flash to SRAM */ - movs r1, #0 - b LoopCopyDataInit - -CopyDataInit: - ldr r3, =_sidata - ldr r3, [r3, r1] - str r3, [r0, r1] - adds r1, r1, #4 - -LoopCopyDataInit: - ldr r0, =_sdata - ldr r3, =_edata - adds r2, r0, r1 - cmp r2, r3 - bcc CopyDataInit - ldr r2, =_sbss - b LoopFillZerobss -/* Zero fill the bss segment. */ -FillZerobss: - movs r3, #0 - str r3, [r2], #4 - -LoopFillZerobss: - ldr r3, = _ebss - cmp r2, r3 - bcc FillZerobss - -/* Call the clock system intitialization function.*/ - bl SystemInit -/* Call static constructors */ - bl __libc_init_array -/* Call the application's entry point.*/ - bl main - bx lr -.size Reset_Handler, .-Reset_Handler - -/** - * @brief This is the code that gets called when the processor receives an - * unexpected interrupt. This simply enters an infinite loop, preserving - * the system state for examination by a debugger. - * - * @param None - * @retval : None -*/ - .section .text.Default_Handler,"ax",%progbits -Default_Handler: -Infinite_Loop: - b Infinite_Loop - .size Default_Handler, .-Default_Handler -/****************************************************************************** -* -* The minimal vector table for a Cortex M3. Note that the proper constructs -* must be placed on this to ensure that it ends up at physical address -* 0x0000.0000. -* -******************************************************************************/ - .section .isr_vector,"a",%progbits - .type g_pfnVectors, %object - .size g_pfnVectors, .-g_pfnVectors - - -g_pfnVectors: - .word _estack - .word Reset_Handler - .word NMI_Handler - .word HardFault_Handler - .word MemManage_Handler - .word BusFault_Handler - .word UsageFault_Handler - .word 0 - .word 0 - .word 0 - .word 0 - .word SVC_Handler - .word DebugMon_Handler - .word 0 - .word PendSV_Handler - .word SysTick_Handler - .word WWDG_IRQHandler - .word PVD_IRQHandler - .word TAMPER_IRQHandler - .word RTC_IRQHandler - .word FLASH_IRQHandler - .word RCC_IRQHandler - .word EXTI0_IRQHandler - .word EXTI1_IRQHandler - .word EXTI2_IRQHandler - .word EXTI3_IRQHandler - .word EXTI4_IRQHandler - .word DMA1_Channel1_IRQHandler - .word DMA1_Channel2_IRQHandler - .word DMA1_Channel3_IRQHandler - .word DMA1_Channel4_IRQHandler - .word DMA1_Channel5_IRQHandler - .word DMA1_Channel6_IRQHandler - .word DMA1_Channel7_IRQHandler - .word ADC1_2_IRQHandler - .word USB_HP_CAN1_TX_IRQHandler - .word USB_LP_CAN1_RX0_IRQHandler - .word CAN1_RX1_IRQHandler - .word CAN1_SCE_IRQHandler - .word EXTI9_5_IRQHandler - .word TIM1_BRK_IRQHandler - .word TIM1_UP_IRQHandler - .word TIM1_TRG_COM_IRQHandler - .word TIM1_CC_IRQHandler - .word TIM2_IRQHandler - .word TIM3_IRQHandler - .word TIM4_IRQHandler - .word I2C1_EV_IRQHandler - .word I2C1_ER_IRQHandler - .word I2C2_EV_IRQHandler - .word I2C2_ER_IRQHandler - .word SPI1_IRQHandler - .word SPI2_IRQHandler - .word USART1_IRQHandler - .word USART2_IRQHandler - .word USART3_IRQHandler - .word EXTI15_10_IRQHandler - .word RTCAlarm_IRQHandler - .word USBWakeUp_IRQHandler - .word TIM8_BRK_IRQHandler - .word TIM8_UP_IRQHandler - .word TIM8_TRG_COM_IRQHandler - .word TIM8_CC_IRQHandler - .word ADC3_IRQHandler - .word FSMC_IRQHandler - .word SDIO_IRQHandler - .word TIM5_IRQHandler - .word SPI3_IRQHandler - .word UART4_IRQHandler - .word UART5_IRQHandler - .word TIM6_IRQHandler - .word TIM7_IRQHandler - .word DMA2_Channel1_IRQHandler - .word DMA2_Channel2_IRQHandler - .word DMA2_Channel3_IRQHandler - .word DMA2_Channel4_5_IRQHandler - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word 0 - .word BootRAM /* @0x1E0. This is for boot in RAM mode for - STM32F10x High Density devices. */ - -/******************************************************************************* -* -* Provide weak aliases for each Exception handler to the Default_Handler. -* As they are weak aliases, any function with the same name will override -* this definition. -* -*******************************************************************************/ - - .weak NMI_Handler - .thumb_set NMI_Handler,Default_Handler - - .weak HardFault_Handler - .thumb_set HardFault_Handler,Default_Handler - - .weak MemManage_Handler - .thumb_set MemManage_Handler,Default_Handler - - .weak BusFault_Handler - .thumb_set BusFault_Handler,Default_Handler - - .weak UsageFault_Handler - .thumb_set UsageFault_Handler,Default_Handler - - .weak SVC_Handler - .thumb_set SVC_Handler,Default_Handler - - .weak DebugMon_Handler - .thumb_set DebugMon_Handler,Default_Handler - - .weak PendSV_Handler - .thumb_set PendSV_Handler,Default_Handler - - .weak SysTick_Handler - .thumb_set SysTick_Handler,Default_Handler - - .weak WWDG_IRQHandler - .thumb_set WWDG_IRQHandler,Default_Handler - - .weak PVD_IRQHandler - .thumb_set PVD_IRQHandler,Default_Handler - - .weak TAMPER_IRQHandler - .thumb_set TAMPER_IRQHandler,Default_Handler - - .weak RTC_IRQHandler - .thumb_set RTC_IRQHandler,Default_Handler - - .weak FLASH_IRQHandler - .thumb_set FLASH_IRQHandler,Default_Handler - - .weak RCC_IRQHandler - .thumb_set RCC_IRQHandler,Default_Handler - - .weak EXTI0_IRQHandler - .thumb_set EXTI0_IRQHandler,Default_Handler - - .weak EXTI1_IRQHandler - .thumb_set EXTI1_IRQHandler,Default_Handler - - .weak EXTI2_IRQHandler - .thumb_set EXTI2_IRQHandler,Default_Handler - - .weak EXTI3_IRQHandler - .thumb_set EXTI3_IRQHandler,Default_Handler - - .weak EXTI4_IRQHandler - .thumb_set EXTI4_IRQHandler,Default_Handler - - .weak DMA1_Channel1_IRQHandler - .thumb_set DMA1_Channel1_IRQHandler,Default_Handler - - .weak DMA1_Channel2_IRQHandler - .thumb_set DMA1_Channel2_IRQHandler,Default_Handler - - .weak DMA1_Channel3_IRQHandler - .thumb_set DMA1_Channel3_IRQHandler,Default_Handler - - .weak DMA1_Channel4_IRQHandler - .thumb_set DMA1_Channel4_IRQHandler,Default_Handler - - .weak DMA1_Channel5_IRQHandler - .thumb_set DMA1_Channel5_IRQHandler,Default_Handler - - .weak DMA1_Channel6_IRQHandler - .thumb_set DMA1_Channel6_IRQHandler,Default_Handler - - .weak DMA1_Channel7_IRQHandler - .thumb_set DMA1_Channel7_IRQHandler,Default_Handler - - .weak ADC1_2_IRQHandler - .thumb_set ADC1_2_IRQHandler,Default_Handler - - .weak USB_HP_CAN1_TX_IRQHandler - .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler - - .weak USB_LP_CAN1_RX0_IRQHandler - .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler - - .weak CAN1_RX1_IRQHandler - .thumb_set CAN1_RX1_IRQHandler,Default_Handler - - .weak CAN1_SCE_IRQHandler - .thumb_set CAN1_SCE_IRQHandler,Default_Handler - - .weak EXTI9_5_IRQHandler - .thumb_set EXTI9_5_IRQHandler,Default_Handler - - .weak TIM1_BRK_IRQHandler - .thumb_set TIM1_BRK_IRQHandler,Default_Handler - - .weak TIM1_UP_IRQHandler - .thumb_set TIM1_UP_IRQHandler,Default_Handler - - .weak TIM1_TRG_COM_IRQHandler - .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler - - .weak TIM1_CC_IRQHandler - .thumb_set TIM1_CC_IRQHandler,Default_Handler - - .weak TIM2_IRQHandler - .thumb_set TIM2_IRQHandler,Default_Handler - - .weak TIM3_IRQHandler - .thumb_set TIM3_IRQHandler,Default_Handler - - .weak TIM4_IRQHandler - .thumb_set TIM4_IRQHandler,Default_Handler - - .weak I2C1_EV_IRQHandler - .thumb_set I2C1_EV_IRQHandler,Default_Handler - - .weak I2C1_ER_IRQHandler - .thumb_set I2C1_ER_IRQHandler,Default_Handler - - .weak I2C2_EV_IRQHandler - .thumb_set I2C2_EV_IRQHandler,Default_Handler - - .weak I2C2_ER_IRQHandler - .thumb_set I2C2_ER_IRQHandler,Default_Handler - - .weak SPI1_IRQHandler - .thumb_set SPI1_IRQHandler,Default_Handler - - .weak SPI2_IRQHandler - .thumb_set SPI2_IRQHandler,Default_Handler - - .weak USART1_IRQHandler - .thumb_set USART1_IRQHandler,Default_Handler - - .weak USART2_IRQHandler - .thumb_set USART2_IRQHandler,Default_Handler - - .weak USART3_IRQHandler - .thumb_set USART3_IRQHandler,Default_Handler - - .weak EXTI15_10_IRQHandler - .thumb_set EXTI15_10_IRQHandler,Default_Handler - - .weak RTCAlarm_IRQHandler - .thumb_set RTCAlarm_IRQHandler,Default_Handler - - .weak USBWakeUp_IRQHandler - .thumb_set USBWakeUp_IRQHandler,Default_Handler - - .weak TIM8_BRK_IRQHandler - .thumb_set TIM8_BRK_IRQHandler,Default_Handler - - .weak TIM8_UP_IRQHandler - .thumb_set TIM8_UP_IRQHandler,Default_Handler - - .weak TIM8_TRG_COM_IRQHandler - .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler - - .weak TIM8_CC_IRQHandler - .thumb_set TIM8_CC_IRQHandler,Default_Handler - - .weak ADC3_IRQHandler - .thumb_set ADC3_IRQHandler,Default_Handler - - .weak FSMC_IRQHandler - .thumb_set FSMC_IRQHandler,Default_Handler - - .weak SDIO_IRQHandler - .thumb_set SDIO_IRQHandler,Default_Handler - - .weak TIM5_IRQHandler - .thumb_set TIM5_IRQHandler,Default_Handler - - .weak SPI3_IRQHandler - .thumb_set SPI3_IRQHandler,Default_Handler - - .weak UART4_IRQHandler - .thumb_set UART4_IRQHandler,Default_Handler - - .weak UART5_IRQHandler - .thumb_set UART5_IRQHandler,Default_Handler - - .weak TIM6_IRQHandler - .thumb_set TIM6_IRQHandler,Default_Handler - - .weak TIM7_IRQHandler - .thumb_set TIM7_IRQHandler,Default_Handler - - .weak DMA2_Channel1_IRQHandler - .thumb_set DMA2_Channel1_IRQHandler,Default_Handler - - .weak DMA2_Channel2_IRQHandler - .thumb_set DMA2_Channel2_IRQHandler,Default_Handler - - .weak DMA2_Channel3_IRQHandler - .thumb_set DMA2_Channel3_IRQHandler,Default_Handler - - .weak DMA2_Channel4_5_IRQHandler - .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler - -/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ +/** + ****************************************************************************** + * @file startup_stm32f10x_hd.s + * @author MCD Application Team + * @version V3.5.0 + * @date 11-March-2011 + * @brief STM32F10x High Density Devices vector table for Atollic toolchain. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address, + * - Configure the clock system + * - Configure external SRAM mounted on STM3210E-EVAL board + * to be used as data memory (optional, to be enabled by user) + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M3 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * @attention + * + * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS + * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE + * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY + * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING + * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE + * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. + * + *

© COPYRIGHT 2011 STMicroelectronics

+ ****************************************************************************** + */ + + .syntax unified + .cpu cortex-m3 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss + +.equ BootRAM, 0xF1E0F85F +/** + * @brief This is the code that gets called when the processor first + * starts execution following a reset event. Only the absolutely + * necessary set is performed, after which the application + * supplied main() routine is called. + * @param None + * @retval : None +*/ + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + +/* Copy the data segment initializers from flash to SRAM */ + movs r1, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r3, =_sidata + ldr r3, [r3, r1] + str r3, [r0, r1] + adds r1, r1, #4 + +LoopCopyDataInit: + ldr r0, =_sdata + ldr r3, =_edata + adds r2, r0, r1 + cmp r2, r3 + bcc CopyDataInit + ldr r2, =_sbss + b LoopFillZerobss +/* Zero fill the bss segment. */ +FillZerobss: + movs r3, #0 + str r3, [r2], #4 + +LoopFillZerobss: + ldr r3, = _ebss + cmp r2, r3 + bcc FillZerobss + +/* Call the clock system intitialization function.*/ + bl SystemInit +/* Call static constructors */ + bl __libc_init_array +/* Call the application's entry point.*/ + bl main + bx lr +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * + * @param None + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex M3. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + .word _estack + .word Reset_Handler + .word NMI_Handler + .word HardFault_Handler + .word MemManage_Handler + .word BusFault_Handler + .word UsageFault_Handler + .word 0 + .word 0 + .word 0 + .word 0 + .word SVC_Handler + .word DebugMon_Handler + .word 0 + .word PendSV_Handler + .word SysTick_Handler + .word WWDG_IRQHandler + .word PVD_IRQHandler + .word TAMPER_IRQHandler + .word RTC_IRQHandler + .word FLASH_IRQHandler + .word RCC_IRQHandler + .word EXTI0_IRQHandler + .word EXTI1_IRQHandler + .word EXTI2_IRQHandler + .word EXTI3_IRQHandler + .word EXTI4_IRQHandler + .word DMA1_Channel1_IRQHandler + .word DMA1_Channel2_IRQHandler + .word DMA1_Channel3_IRQHandler + .word DMA1_Channel4_IRQHandler + .word DMA1_Channel5_IRQHandler + .word DMA1_Channel6_IRQHandler + .word DMA1_Channel7_IRQHandler + .word ADC1_2_IRQHandler + .word USB_HP_CAN1_TX_IRQHandler + .word USB_LP_CAN1_RX0_IRQHandler + .word CAN1_RX1_IRQHandler + .word CAN1_SCE_IRQHandler + .word EXTI9_5_IRQHandler + .word TIM1_BRK_IRQHandler + .word TIM1_UP_IRQHandler + .word TIM1_TRG_COM_IRQHandler + .word TIM1_CC_IRQHandler + .word TIM2_IRQHandler + .word TIM3_IRQHandler + .word TIM4_IRQHandler + .word I2C1_EV_IRQHandler + .word I2C1_ER_IRQHandler + .word I2C2_EV_IRQHandler + .word I2C2_ER_IRQHandler + .word SPI1_IRQHandler + .word SPI2_IRQHandler + .word USART1_IRQHandler + .word USART2_IRQHandler + .word USART3_IRQHandler + .word EXTI15_10_IRQHandler + .word RTCAlarm_IRQHandler + .word USBWakeUp_IRQHandler + .word TIM8_BRK_IRQHandler + .word TIM8_UP_IRQHandler + .word TIM8_TRG_COM_IRQHandler + .word TIM8_CC_IRQHandler + .word ADC3_IRQHandler + .word FSMC_IRQHandler + .word SDIO_IRQHandler + .word TIM5_IRQHandler + .word SPI3_IRQHandler + .word UART4_IRQHandler + .word UART5_IRQHandler + .word TIM6_IRQHandler + .word TIM7_IRQHandler + .word DMA2_Channel1_IRQHandler + .word DMA2_Channel2_IRQHandler + .word DMA2_Channel3_IRQHandler + .word DMA2_Channel4_5_IRQHandler + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word BootRAM /* @0x1E0. This is for boot in RAM mode for + STM32F10x High Density devices. */ + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak MemManage_Handler + .thumb_set MemManage_Handler,Default_Handler + + .weak BusFault_Handler + .thumb_set BusFault_Handler,Default_Handler + + .weak UsageFault_Handler + .thumb_set UsageFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IRQHandler + .thumb_set WWDG_IRQHandler,Default_Handler + + .weak PVD_IRQHandler + .thumb_set PVD_IRQHandler,Default_Handler + + .weak TAMPER_IRQHandler + .thumb_set TAMPER_IRQHandler,Default_Handler + + .weak RTC_IRQHandler + .thumb_set RTC_IRQHandler,Default_Handler + + .weak FLASH_IRQHandler + .thumb_set FLASH_IRQHandler,Default_Handler + + .weak RCC_IRQHandler + .thumb_set RCC_IRQHandler,Default_Handler + + .weak EXTI0_IRQHandler + .thumb_set EXTI0_IRQHandler,Default_Handler + + .weak EXTI1_IRQHandler + .thumb_set EXTI1_IRQHandler,Default_Handler + + .weak EXTI2_IRQHandler + .thumb_set EXTI2_IRQHandler,Default_Handler + + .weak EXTI3_IRQHandler + .thumb_set EXTI3_IRQHandler,Default_Handler + + .weak EXTI4_IRQHandler + .thumb_set EXTI4_IRQHandler,Default_Handler + + .weak DMA1_Channel1_IRQHandler + .thumb_set DMA1_Channel1_IRQHandler,Default_Handler + + .weak DMA1_Channel2_IRQHandler + .thumb_set DMA1_Channel2_IRQHandler,Default_Handler + + .weak DMA1_Channel3_IRQHandler + .thumb_set DMA1_Channel3_IRQHandler,Default_Handler + + .weak DMA1_Channel4_IRQHandler + .thumb_set DMA1_Channel4_IRQHandler,Default_Handler + + .weak DMA1_Channel5_IRQHandler + .thumb_set DMA1_Channel5_IRQHandler,Default_Handler + + .weak DMA1_Channel6_IRQHandler + .thumb_set DMA1_Channel6_IRQHandler,Default_Handler + + .weak DMA1_Channel7_IRQHandler + .thumb_set DMA1_Channel7_IRQHandler,Default_Handler + + .weak ADC1_2_IRQHandler + .thumb_set ADC1_2_IRQHandler,Default_Handler + + .weak USB_HP_CAN1_TX_IRQHandler + .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler + + .weak USB_LP_CAN1_RX0_IRQHandler + .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler + + .weak CAN1_RX1_IRQHandler + .thumb_set CAN1_RX1_IRQHandler,Default_Handler + + .weak CAN1_SCE_IRQHandler + .thumb_set CAN1_SCE_IRQHandler,Default_Handler + + .weak EXTI9_5_IRQHandler + .thumb_set EXTI9_5_IRQHandler,Default_Handler + + .weak TIM1_BRK_IRQHandler + .thumb_set TIM1_BRK_IRQHandler,Default_Handler + + .weak TIM1_UP_IRQHandler + .thumb_set TIM1_UP_IRQHandler,Default_Handler + + .weak TIM1_TRG_COM_IRQHandler + .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler + + .weak TIM1_CC_IRQHandler + .thumb_set TIM1_CC_IRQHandler,Default_Handler + + .weak TIM2_IRQHandler + .thumb_set TIM2_IRQHandler,Default_Handler + + .weak TIM3_IRQHandler + .thumb_set TIM3_IRQHandler,Default_Handler + + .weak TIM4_IRQHandler + .thumb_set TIM4_IRQHandler,Default_Handler + + .weak I2C1_EV_IRQHandler + .thumb_set I2C1_EV_IRQHandler,Default_Handler + + .weak I2C1_ER_IRQHandler + .thumb_set I2C1_ER_IRQHandler,Default_Handler + + .weak I2C2_EV_IRQHandler + .thumb_set I2C2_EV_IRQHandler,Default_Handler + + .weak I2C2_ER_IRQHandler + .thumb_set I2C2_ER_IRQHandler,Default_Handler + + .weak SPI1_IRQHandler + .thumb_set SPI1_IRQHandler,Default_Handler + + .weak SPI2_IRQHandler + .thumb_set SPI2_IRQHandler,Default_Handler + + .weak USART1_IRQHandler + .thumb_set USART1_IRQHandler,Default_Handler + + .weak USART2_IRQHandler + .thumb_set USART2_IRQHandler,Default_Handler + + .weak USART3_IRQHandler + .thumb_set USART3_IRQHandler,Default_Handler + + .weak EXTI15_10_IRQHandler + .thumb_set EXTI15_10_IRQHandler,Default_Handler + + .weak RTCAlarm_IRQHandler + .thumb_set RTCAlarm_IRQHandler,Default_Handler + + .weak USBWakeUp_IRQHandler + .thumb_set USBWakeUp_IRQHandler,Default_Handler + + .weak TIM8_BRK_IRQHandler + .thumb_set TIM8_BRK_IRQHandler,Default_Handler + + .weak TIM8_UP_IRQHandler + .thumb_set TIM8_UP_IRQHandler,Default_Handler + + .weak TIM8_TRG_COM_IRQHandler + .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler + + .weak TIM8_CC_IRQHandler + .thumb_set TIM8_CC_IRQHandler,Default_Handler + + .weak ADC3_IRQHandler + .thumb_set ADC3_IRQHandler,Default_Handler + + .weak FSMC_IRQHandler + .thumb_set FSMC_IRQHandler,Default_Handler + + .weak SDIO_IRQHandler + .thumb_set SDIO_IRQHandler,Default_Handler + + .weak TIM5_IRQHandler + .thumb_set TIM5_IRQHandler,Default_Handler + + .weak SPI3_IRQHandler + .thumb_set SPI3_IRQHandler,Default_Handler + + .weak UART4_IRQHandler + .thumb_set UART4_IRQHandler,Default_Handler + + .weak UART5_IRQHandler + .thumb_set UART5_IRQHandler,Default_Handler + + .weak TIM6_IRQHandler + .thumb_set TIM6_IRQHandler,Default_Handler + + .weak TIM7_IRQHandler + .thumb_set TIM7_IRQHandler,Default_Handler + + .weak DMA2_Channel1_IRQHandler + .thumb_set DMA2_Channel1_IRQHandler,Default_Handler + + .weak DMA2_Channel2_IRQHandler + .thumb_set DMA2_Channel2_IRQHandler,Default_Handler + + .weak DMA2_Channel3_IRQHandler + .thumb_set DMA2_Channel3_IRQHandler,Default_Handler + + .weak DMA2_Channel4_5_IRQHandler + .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler + +/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ diff --git a/firmware/libs/spl/Makefile.linux b/firmware/libs/spl/Makefile.linux index edcf939..f7ceda4 100644 --- a/firmware/libs/spl/Makefile.linux +++ b/firmware/libs/spl/Makefile.linux @@ -4,6 +4,11 @@ SRC_DIR=CMSIS/CM3/CoreSupport/ STM32F10x_StdPeriph_Driver/src/ \ STM32_USB-FS-Device_Driver/src/ OBJ_DIR=obj/ +TOOLCHAIN=../../../../compiler/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi- + +CC=$(TOOLCHAIN)gcc +AR=$(TOOLCHAIN)ar + CHIP=STM32F10X_MD CONFIG_FILE=stm32f10x_conf.h @@ -15,7 +20,10 @@ INCLUDES+=-ISTM32_USB-FS-Device_Driver/inc/ INCLUDES+=-ICMSIS/CM3/DeviceSupport/ST/STM32F10x/ INCLUDES+=-ICMSIS/CM3/CoreSupport/ -override CFLAGS := $(CFLAGS) $(INCLUDES) -ffreestanding -nostdlib +CFLAGS=-g -Wall -Werror -O3 +CFLAGS+=-D$(CHIP) $(INCLUDES) -MMD -MP +CFLAGS+=-mcpu=cortex-m3 -mthumb +CFLAGS+=-ffreestanding -nostdlib vpath %.c $(SRC_DIR) @@ -27,13 +35,12 @@ SRCS_PERIPH=misc.c stm32f10x_cec.c stm32f10x_dma.c stm32f10x_gpio.c \ stm32f10x_bkp.c stm32f10x_dac.c stm32f10x_flash.c stm32f10x_iwdg.c \ stm32f10x_sdio.c stm32f10x_wwdg.c stm32f10x_can.c stm32f10x_dbgmcu.c \ stm32f10x_fsmc.c stm32f10x_pwr.c stm32f10x_spi.c -STARTUP=startup_stm32f10x_hd.s SRCS_USB=usb_core.c usb_init.c usb_int.c usb_mem.c usb_regs.c usb_sil.c SRCS=$(SRCS_CORE) $(SRCS_PERIPH) $(SRCS_USB) -OBJS=$(addprefix $(OBJ_DIR),$(SRCS:.c=.o)) \ - $(addprefix $(OBJ_DIR),$(STARTUP:.s=.o)) + +OBJS=$(addprefix $(OBJ_DIR),$(SRCS:.c=.o)) DEPS=$(OBJS:%.o=%.d) all: dirs $(LIB_NAME) @@ -46,8 +53,6 @@ $(LIB_NAME): $(OBJS) $(OBJ_DIR)%.o: %.c $(CC) $(CFLAGS) -c $< -o $@ -$(OBJ_DIR)%.o: %.s - $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ -include $(DEPS) diff --git a/firmware/libs/spl/init.c b/firmware/libs/spl/init.c deleted file mode 100644 index 0e929cb..0000000 --- a/firmware/libs/spl/init.c +++ /dev/null @@ -1,3 +0,0 @@ -void _init(void) { - // Custom initialization code for your system (optional) -} diff --git a/firmware/programmer/Makefile.linux b/firmware/programmer/Makefile.linux index cb1a52d..401ab43 100644 --- a/firmware/programmer/Makefile.linux +++ b/firmware/programmer/Makefile.linux @@ -9,6 +9,7 @@ USB_DIR=../usb_cdc/ OBJ_DIR=obj/ LIB_DIR=../libs/ INCLUDE_DIR=../ +TOOLCHAIN=../../../compiler/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi- APP_1=$(OBJ_DIR)$(APP_NAME)_1 APP_2=$(OBJ_DIR)$(APP_NAME)_2 @@ -19,7 +20,12 @@ SPL_PERIPH_PATH=$(SPL_PATH)STM32F10x_StdPeriph_Driver/ SPL_USB_PATH=$(SPL_PATH)STM32_USB-FS-Device_Driver/ SPL_LIB=stm32f10x SPL_CONFIG_FILE=$(SPL_PATH)stm32f10x_conf.h +SPL_FLAGS=-DSTM32F10X_HD -DCONFIG_BOOTLOADER +CC=$(TOOLCHAIN)gcc +OBJCOPY=$(TOOLCHAIN)objcopy +OBJDUMP=$(TOOLCHAIN)objdump +SIZE=$(TOOLCHAIN)size INCLUDES=-include$(SPL_CONFIG_FILE) INCLUDES+=-I$(INCLUDE_DIR) @@ -31,7 +37,11 @@ INCLUDES+=-I$(SPL_USB_PATH)inc INCLUDES+=-I$(SRC_DIR) INCLUDES+=-I$(USB_DIR) -#override CFLAGS := $(CFLAGS) $(INCLUDES) +CFLAGS=-g -Wall -Werror -O3 +CFLAGS+=$(INCLUDES) -MMD -MP +CFLAGS+=-ffunction-sections -fdata-sections +CFLAGS+=-mcpu=cortex-m3 -mthumb +CFLAGS+=$(SPL_FLAGS) LDFLAGS_1=-mcpu=cortex-m3 -mthumb -Wl,--gc-sections -Wl,-Map=$(APP_1).map LDFLAGS_2=-mcpu=cortex-m3 -mthumb -Wl,--gc-sections -Wl,-Map=$(APP_2).map @@ -39,6 +49,7 @@ LDFLAGS_2=-mcpu=cortex-m3 -mthumb -Wl,--gc-sections -Wl,-Map=$(APP_2).map vpath %.c $(SRC_DIR) $(SPL_DEVICE_SUPPORT_PATH) $(SRC_BSP_DIR) $(USB_DIR) vpath %.s $(SRC_DIR) +STARTUP=startup_stm32f10x_hd.s USB_SRCS=hw_config.c stm32_it.c usb_prop.c usb_desc.c usb_istr.c usb_pwr.c \ usb_endp.c usb.c @@ -46,7 +57,8 @@ SRCS=main.c system_stm32f10x.c syscalls.c fsmc_nand.c led.c uart.c jtag.c \ clock.c cdc.c nand_programmer.c nand_bad_block.c flash.c spi_flash.c \ $(USB_SRCS) -OBJS=$(addprefix $(OBJ_DIR),$(SRCS:.c=.o)) +OBJS=$(addprefix $(OBJ_DIR),$(SRCS:.c=.o)) \ + $(addprefix $(OBJ_DIR),$(STARTUP:.s=.o)) DEPS=$(OBJS:%.o=%.d) LINKER_SCRIPT_1=$(SRC_DIR)stm32_flash_1.ld @@ -55,13 +67,13 @@ LINKER_SCRIPT_2=$(SRC_DIR)stm32_flash_2.ld all: lib dirs $(APP_1).elf $(APP_2).elf lib: - $(MAKE) -C $(SPL_PATH) CC=$(CC) AR=$(AR) CFLAGS="$(CFLAGS)" + $(MAKE) -C $(SPL_PATH) dirs: mkdir -p $(OBJ_DIR) $(APP_1).elf: $(OBJS) - $(CC) $(LDFLAGS_1) $(CFLAGS) $(INCLUDES) -o $@ $^ -L$(SPL_PATH) -l$(SPL_LIB) \ + $(CC) $(LDFLAGS_1) -o $@ $^ -L$(SPL_PATH) -l$(SPL_LIB) \ -T$(LINKER_SCRIPT_1) $(OBJCOPY) --pad-to 0x08022000 -O ihex $(APP_1).elf $(APP_1).hex $(OBJCOPY) -O binary $(APP_1).elf $(APP_1).bin @@ -69,7 +81,7 @@ $(APP_1).elf: $(OBJS) $(SIZE) $(APP_1).elf $(APP_2).elf: $(OBJS) - $(CC) $(LDFLAGS_2) $(CFLAGS) $(INCLUDES) -o $@ $^ -L$(SPL_PATH) -l$(SPL_LIB) \ + $(CC) $(LDFLAGS_2) -o $@ $^ -L$(SPL_PATH) -l$(SPL_LIB) \ -T$(LINKER_SCRIPT_2) $(OBJCOPY) --pad-to 0x08040000 -O ihex $(APP_2).elf $(APP_2).hex $(OBJCOPY) -O binary $(APP_2).elf $(APP_2).bin @@ -77,7 +89,10 @@ $(APP_2).elf: $(OBJS) $(SIZE) $(APP_2).elf $(OBJ_DIR)%.o: %.c - $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ + $(CC) -c $(CFLAGS) $< -o $@ + +$(OBJ_DIR)%.o: %.s + $(CC) -c $(CFLAGS) $< -o $@ -include $(DEPS) diff --git a/firmware/programmer/cdc.c b/firmware/programmer/cdc.c index c39f4c9..fb83b6d 100644 --- a/firmware/programmer/cdc.c +++ b/firmware/programmer/cdc.c @@ -5,7 +5,7 @@ #include "log.h" #include "nand_programmer.h" -#include "hw_config.h" +#include #define SEND_TIMEOUT 0x1000000 diff --git a/firmware/programmer/fsmc_nand.c b/firmware/programmer/fsmc_nand.c index 4273eb7..625a2f0 100644 --- a/firmware/programmer/fsmc_nand.c +++ b/firmware/programmer/fsmc_nand.c @@ -140,7 +140,7 @@ static void nand_print_fsmc_info() DEBUG_PRINT("Erase 1 command: %d\r\n", fsmc_conf.erase1_cmd); DEBUG_PRINT("Erase 2 command: %d\r\n", fsmc_conf.erase2_cmd); DEBUG_PRINT("Status command: %d\r\n", fsmc_conf.status_cmd); -// DEBUG_PRINT("Set feature command: %d\r\n", fsmc_conf.set_feature_cmd); + DEBUG_PRINT("Set feature command: %d\r\n", fsmc_conf.set_feature_cmd); DEBUG_PRINT("Enable ECC address: %d\r\n", fsmc_conf.enable_ecc_addr); DEBUG_PRINT("Enable ECC value: %d\r\n", fsmc_conf.enable_ecc_value); DEBUG_PRINT("Disable ECC value: %d\r\n", fsmc_conf.disable_ecc_value); diff --git a/firmware/programmer/startup_stm32f10x_hd.s b/firmware/programmer/startup_stm32f10x_hd.s new file mode 100644 index 0000000..0aa9188 --- /dev/null +++ b/firmware/programmer/startup_stm32f10x_hd.s @@ -0,0 +1,469 @@ +/** + ****************************************************************************** + * @file startup_stm32f10x_hd.s + * @author MCD Application Team + * @version V3.5.0 + * @date 11-March-2011 + * @brief STM32F10x High Density Devices vector table for Atollic toolchain. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address, + * - Configure the clock system + * - Configure external SRAM mounted on STM3210E-EVAL board + * to be used as data memory (optional, to be enabled by user) + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M3 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * @attention + * + * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS + * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE + * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY + * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING + * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE + * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. + * + *

© COPYRIGHT 2011 STMicroelectronics

+ ****************************************************************************** + */ + + .syntax unified + .cpu cortex-m3 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss + +.equ BootRAM, 0xF1E0F85F +/** + * @brief This is the code that gets called when the processor first + * starts execution following a reset event. Only the absolutely + * necessary set is performed, after which the application + * supplied main() routine is called. + * @param None + * @retval : None +*/ + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + +/* Copy the data segment initializers from flash to SRAM */ + movs r1, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r3, =_sidata + ldr r3, [r3, r1] + str r3, [r0, r1] + adds r1, r1, #4 + +LoopCopyDataInit: + ldr r0, =_sdata + ldr r3, =_edata + adds r2, r0, r1 + cmp r2, r3 + bcc CopyDataInit + ldr r2, =_sbss + b LoopFillZerobss +/* Zero fill the bss segment. */ +FillZerobss: + movs r3, #0 + str r3, [r2], #4 + +LoopFillZerobss: + ldr r3, = _ebss + cmp r2, r3 + bcc FillZerobss + +/* Call the clock system intitialization function.*/ + bl SystemInit +/* Call static constructors */ + bl __libc_init_array +/* Call the application's entry point.*/ + bl main + bx lr +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * + * @param None + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex M3. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + .word _estack + .word Reset_Handler + .word NMI_Handler + .word HardFault_Handler + .word MemManage_Handler + .word BusFault_Handler + .word UsageFault_Handler + .word 0 + .word 0 + .word 0 + .word 0 + .word SVC_Handler + .word DebugMon_Handler + .word 0 + .word PendSV_Handler + .word SysTick_Handler + .word WWDG_IRQHandler + .word PVD_IRQHandler + .word TAMPER_IRQHandler + .word RTC_IRQHandler + .word FLASH_IRQHandler + .word RCC_IRQHandler + .word EXTI0_IRQHandler + .word EXTI1_IRQHandler + .word EXTI2_IRQHandler + .word EXTI3_IRQHandler + .word EXTI4_IRQHandler + .word DMA1_Channel1_IRQHandler + .word DMA1_Channel2_IRQHandler + .word DMA1_Channel3_IRQHandler + .word DMA1_Channel4_IRQHandler + .word DMA1_Channel5_IRQHandler + .word DMA1_Channel6_IRQHandler + .word DMA1_Channel7_IRQHandler + .word ADC1_2_IRQHandler + .word USB_HP_CAN1_TX_IRQHandler + .word USB_LP_CAN1_RX0_IRQHandler + .word CAN1_RX1_IRQHandler + .word CAN1_SCE_IRQHandler + .word EXTI9_5_IRQHandler + .word TIM1_BRK_IRQHandler + .word TIM1_UP_IRQHandler + .word TIM1_TRG_COM_IRQHandler + .word TIM1_CC_IRQHandler + .word TIM2_IRQHandler + .word TIM3_IRQHandler + .word TIM4_IRQHandler + .word I2C1_EV_IRQHandler + .word I2C1_ER_IRQHandler + .word I2C2_EV_IRQHandler + .word I2C2_ER_IRQHandler + .word SPI1_IRQHandler + .word SPI2_IRQHandler + .word USART1_IRQHandler + .word USART2_IRQHandler + .word USART3_IRQHandler + .word EXTI15_10_IRQHandler + .word RTCAlarm_IRQHandler + .word USBWakeUp_IRQHandler + .word TIM8_BRK_IRQHandler + .word TIM8_UP_IRQHandler + .word TIM8_TRG_COM_IRQHandler + .word TIM8_CC_IRQHandler + .word ADC3_IRQHandler + .word FSMC_IRQHandler + .word SDIO_IRQHandler + .word TIM5_IRQHandler + .word SPI3_IRQHandler + .word UART4_IRQHandler + .word UART5_IRQHandler + .word TIM6_IRQHandler + .word TIM7_IRQHandler + .word DMA2_Channel1_IRQHandler + .word DMA2_Channel2_IRQHandler + .word DMA2_Channel3_IRQHandler + .word DMA2_Channel4_5_IRQHandler + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word BootRAM /* @0x1E0. This is for boot in RAM mode for + STM32F10x High Density devices. */ + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak MemManage_Handler + .thumb_set MemManage_Handler,Default_Handler + + .weak BusFault_Handler + .thumb_set BusFault_Handler,Default_Handler + + .weak UsageFault_Handler + .thumb_set UsageFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IRQHandler + .thumb_set WWDG_IRQHandler,Default_Handler + + .weak PVD_IRQHandler + .thumb_set PVD_IRQHandler,Default_Handler + + .weak TAMPER_IRQHandler + .thumb_set TAMPER_IRQHandler,Default_Handler + + .weak RTC_IRQHandler + .thumb_set RTC_IRQHandler,Default_Handler + + .weak FLASH_IRQHandler + .thumb_set FLASH_IRQHandler,Default_Handler + + .weak RCC_IRQHandler + .thumb_set RCC_IRQHandler,Default_Handler + + .weak EXTI0_IRQHandler + .thumb_set EXTI0_IRQHandler,Default_Handler + + .weak EXTI1_IRQHandler + .thumb_set EXTI1_IRQHandler,Default_Handler + + .weak EXTI2_IRQHandler + .thumb_set EXTI2_IRQHandler,Default_Handler + + .weak EXTI3_IRQHandler + .thumb_set EXTI3_IRQHandler,Default_Handler + + .weak EXTI4_IRQHandler + .thumb_set EXTI4_IRQHandler,Default_Handler + + .weak DMA1_Channel1_IRQHandler + .thumb_set DMA1_Channel1_IRQHandler,Default_Handler + + .weak DMA1_Channel2_IRQHandler + .thumb_set DMA1_Channel2_IRQHandler,Default_Handler + + .weak DMA1_Channel3_IRQHandler + .thumb_set DMA1_Channel3_IRQHandler,Default_Handler + + .weak DMA1_Channel4_IRQHandler + .thumb_set DMA1_Channel4_IRQHandler,Default_Handler + + .weak DMA1_Channel5_IRQHandler + .thumb_set DMA1_Channel5_IRQHandler,Default_Handler + + .weak DMA1_Channel6_IRQHandler + .thumb_set DMA1_Channel6_IRQHandler,Default_Handler + + .weak DMA1_Channel7_IRQHandler + .thumb_set DMA1_Channel7_IRQHandler,Default_Handler + + .weak ADC1_2_IRQHandler + .thumb_set ADC1_2_IRQHandler,Default_Handler + + .weak USB_HP_CAN1_TX_IRQHandler + .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler + + .weak USB_LP_CAN1_RX0_IRQHandler + .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler + + .weak CAN1_RX1_IRQHandler + .thumb_set CAN1_RX1_IRQHandler,Default_Handler + + .weak CAN1_SCE_IRQHandler + .thumb_set CAN1_SCE_IRQHandler,Default_Handler + + .weak EXTI9_5_IRQHandler + .thumb_set EXTI9_5_IRQHandler,Default_Handler + + .weak TIM1_BRK_IRQHandler + .thumb_set TIM1_BRK_IRQHandler,Default_Handler + + .weak TIM1_UP_IRQHandler + .thumb_set TIM1_UP_IRQHandler,Default_Handler + + .weak TIM1_TRG_COM_IRQHandler + .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler + + .weak TIM1_CC_IRQHandler + .thumb_set TIM1_CC_IRQHandler,Default_Handler + + .weak TIM2_IRQHandler + .thumb_set TIM2_IRQHandler,Default_Handler + + .weak TIM3_IRQHandler + .thumb_set TIM3_IRQHandler,Default_Handler + + .weak TIM4_IRQHandler + .thumb_set TIM4_IRQHandler,Default_Handler + + .weak I2C1_EV_IRQHandler + .thumb_set I2C1_EV_IRQHandler,Default_Handler + + .weak I2C1_ER_IRQHandler + .thumb_set I2C1_ER_IRQHandler,Default_Handler + + .weak I2C2_EV_IRQHandler + .thumb_set I2C2_EV_IRQHandler,Default_Handler + + .weak I2C2_ER_IRQHandler + .thumb_set I2C2_ER_IRQHandler,Default_Handler + + .weak SPI1_IRQHandler + .thumb_set SPI1_IRQHandler,Default_Handler + + .weak SPI2_IRQHandler + .thumb_set SPI2_IRQHandler,Default_Handler + + .weak USART1_IRQHandler + .thumb_set USART1_IRQHandler,Default_Handler + + .weak USART2_IRQHandler + .thumb_set USART2_IRQHandler,Default_Handler + + .weak USART3_IRQHandler + .thumb_set USART3_IRQHandler,Default_Handler + + .weak EXTI15_10_IRQHandler + .thumb_set EXTI15_10_IRQHandler,Default_Handler + + .weak RTCAlarm_IRQHandler + .thumb_set RTCAlarm_IRQHandler,Default_Handler + + .weak USBWakeUp_IRQHandler + .thumb_set USBWakeUp_IRQHandler,Default_Handler + + .weak TIM8_BRK_IRQHandler + .thumb_set TIM8_BRK_IRQHandler,Default_Handler + + .weak TIM8_UP_IRQHandler + .thumb_set TIM8_UP_IRQHandler,Default_Handler + + .weak TIM8_TRG_COM_IRQHandler + .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler + + .weak TIM8_CC_IRQHandler + .thumb_set TIM8_CC_IRQHandler,Default_Handler + + .weak ADC3_IRQHandler + .thumb_set ADC3_IRQHandler,Default_Handler + + .weak FSMC_IRQHandler + .thumb_set FSMC_IRQHandler,Default_Handler + + .weak SDIO_IRQHandler + .thumb_set SDIO_IRQHandler,Default_Handler + + .weak TIM5_IRQHandler + .thumb_set TIM5_IRQHandler,Default_Handler + + .weak SPI3_IRQHandler + .thumb_set SPI3_IRQHandler,Default_Handler + + .weak UART4_IRQHandler + .thumb_set UART4_IRQHandler,Default_Handler + + .weak UART5_IRQHandler + .thumb_set UART5_IRQHandler,Default_Handler + + .weak TIM6_IRQHandler + .thumb_set TIM6_IRQHandler,Default_Handler + + .weak TIM7_IRQHandler + .thumb_set TIM7_IRQHandler,Default_Handler + + .weak DMA2_Channel1_IRQHandler + .thumb_set DMA2_Channel1_IRQHandler,Default_Handler + + .weak DMA2_Channel2_IRQHandler + .thumb_set DMA2_Channel2_IRQHandler,Default_Handler + + .weak DMA2_Channel3_IRQHandler + .thumb_set DMA2_Channel3_IRQHandler,Default_Handler + + .weak DMA2_Channel4_5_IRQHandler + .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler + +/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ diff --git a/firmware/usb_cdc/usb_endp.c b/firmware/usb_cdc/usb_endp.c index 4236b3d..6443abc 100644 --- a/firmware/usb_cdc/usb_endp.c +++ b/firmware/usb_cdc/usb_endp.c @@ -123,15 +123,13 @@ void USB_DataRx_Sched(void) void EP3_OUT_Callback(void) { Receive_length = GetEPRxCount(ENDP3); - if (size < CIRC_BUF_SIZE && Receive_length > 0) + if (size < CIRC_BUF_SIZE) { tail = (tail + 1) % CIRC_BUF_SIZE; PMAToUserBufferCopy(circ_buf[tail].pbuf, ENDP3_RXADDR, Receive_length); circ_buf[tail].len = Receive_length; size++; - } - if(size < CIRC_BUF_SIZE){ - USB_DataRx_Sched_Internal(); + USB_DataRx_Sched_Internal(); } } diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt deleted file mode 100644 index a73a10a..0000000 --- a/qt/CMakeLists.txt +++ /dev/null @@ -1,92 +0,0 @@ -cmake_minimum_required(VERSION 3.17) -project(nand_programmer) - -# Set the CMAKE_PREFIX_PATH to find Qt5 -set(CMAKE_PREFIX_PATH "/opt/local/libexec/qt5/lib/cmake/Qt5" ${CMAKE_PREFIX_PATH}) - -# Set C++ standard -set(CMAKE_CXX_STANDARD 14) - -# Find Qt5 Widgets -find_package(Qt5 REQUIRED COMPONENTS Widgets SerialPort) - -# Enable Qt's AUTOMOC (meta-object compiler) feature -set(CMAKE_AUTOMOC ON) -# Enable AUTOMOC (to process Qt's meta-object code) and AUTOUIC (to process .ui files) -set(CMAKE_AUTOUIC ON) - -# Include directories (Qt headers should be found automatically) -include_directories(.) - -# Set Boost root directory -set(BOOST_ROOT "/opt/local") -set(BOOST_INCLUDEDIR "/opt/local/include") -set(BOOST_LIBRARYDIR "/opt/local/lib") -find_package(Boost REQUIRED COMPONENTS system thread) - -# If you use Boost headers -include_directories(${Boost_INCLUDE_DIRS}) -include_directories(${CMAKE_SOURCE_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5SerialPort_INCLUDE_DIRS}) -file(GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ${CMAKE_SOURCE_DIR}/*.cpp ${CMAKE_SOURCE_DIR}/*.ui) -if (APPLE) - add_executable(nand_programmer - MACOSX_BUNDLE # Specify this flag to create a macOS app bundle - ${APP_SOURCES} - ) -else () - add_executable(nand_programmer - ${APP_SOURCES} - ) -endif () -# Copy CSV files into the build directory -file(COPY ${CMAKE_SOURCE_DIR}/nando_parallel_chip_db.csv DESTINATION ${CMAKE_BINARY_DIR}/) -file(COPY ${CMAKE_SOURCE_DIR}/nando_spi_chip_db.csv DESTINATION ${CMAKE_BINARY_DIR}/) - -# Link with Qt5 Widgets -target_link_libraries(nand_programmer Qt5::Widgets Qt5::SerialPort Boost::system Boost::thread) - - -if (APPLE) - set_target_properties(nand_programmer PROPERTIES - MACOSX_BUNDLE_ICON_FILE app_icon.icns # Optional: Set app icon (replace with your .icns file) - MACOSX_BUNDLE_GUI_IDENTIFIER com.example.nandprogrammer - MACOSX_BUNDLE_BUNDLE_VERSION 1.0 - MACOSX_BUNDLE_SHORT_VERSION_STRING 1.0.0 - ) - set(MACDEPLOYQT_PATH "/opt/local/libexec/qt5/bin/macdeployqt") - - file(COPY ${CMAKE_SOURCE_DIR}/nando_parallel_chip_db.csv - DESTINATION ${CMAKE_BINARY_DIR}/nand_programmer.app/Contents/Resources) - - file(COPY ${CMAKE_SOURCE_DIR}/nando_spi_chip_db.csv - DESTINATION ${CMAKE_BINARY_DIR}/nand_programmer.app/Contents/Resources) - - - - # Set the path to your icon file - set(MACOS_APP_ICON ${CMAKE_SOURCE_DIR}/img/app_icon.icns) - - file(COPY ${MACOS_APP_ICON} DESTINATION ${CMAKE_BINARY_DIR}/nand_programmer.app/Contents/Resources) - - - # Add the post-build command to run macdeployqt - add_custom_command(TARGET nand_programmer POST_BUILD - COMMAND ${MACDEPLOYQT_PATH} ${CMAKE_BINARY_DIR}/nand_programmer.app - COMMENT "Running macdeployqt to bundle Qt libraries" - ) - - # Path to your create-dmg command - find_program(CREATE_DMG create-dmg) - - if(CREATE_DMG) - add_custom_command(TARGET nand_programmer POST_BUILD - COMMAND ${CREATE_DMG} - --volname "Nand Programmer" - ${CMAKE_BINARY_DIR}/nand_programmer.dmg - ${CMAKE_BINARY_DIR}/nand_programmer.app - COMMENT "Creating macOS DMG" - ) - else() - message(WARNING "create-dmg not found, DMG creation will be skipped.") - endif() -endif () diff --git a/qt/chip_db.cpp b/qt/chip_db.cpp index 111a0f5..32e8b63 100644 --- a/qt/chip_db.cpp +++ b/qt/chip_db.cpp @@ -9,9 +9,6 @@ #include #include #include -#ifdef Q_OS_MAC -#include -#endif ChipDb::ChipDb() { @@ -133,17 +130,6 @@ bool ChipDb::isOptParamValid(quint64 param, quint64 min, quint64 max) QString ChipDb::findFile(QString fileName) { -#ifdef Q_OS_MAC - // First, check if the file exists in the app's Resources folder - QString appDir = QCoreApplication::applicationDirPath(); - QString resourcesPath = appDir + "/../Resources"; - QString filePath = resourcesPath + "/" + fileName; - - // Check if the file exists in the Resources folder - if (QFileInfo(filePath).exists()) { - return filePath; - } -#endif if (!QFileInfo(fileName).exists() && (fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, fileName)).isNull()) diff --git a/qt/img/app_icon.icns b/qt/img/app_icon.icns deleted file mode 100644 index d0cd467..0000000 Binary files a/qt/img/app_icon.icns and /dev/null differ diff --git a/qt/nando_parallel_chip_db.csv b/qt/nando_parallel_chip_db.csv old mode 100755 new mode 100644 index 99f2682..8c46eb5 --- a/qt/nando_parallel_chip_db.csv +++ b/qt/nando_parallel_chip_db.csv @@ -1,41 +1,20 @@ -# name,page size,block size,total size,spare size,bad block mark off.,tCS,tCLS,tALS,tCLR,tAR,tWP,tRP,tDS,tCH,tCLH,tALH,tWC,tRC,tREA,row cycles,col. cycles,read 1 cycle com.,read 2 cycle com.,read spare com.,read ID com.,reset com.,write 1 cycle com.,write 2 cycle com.,erase 1 cycle com.,erase 2 cycle com.,status com.,set feat. com.,en. ECC addr,en. ECC val.,dis. ECC val.,ID1,ID2,ID3,ID4,ID5,ID6 -K9F2G08U0C, 2048, 131072, 268435456, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 218, 16, 149, 68, - -K9F1G08U0D, 2048, 131072, 134217728, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 241, 0, 149, 64, - -K9F1G08U0E, 2048, 131072, 134217728, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 241, 0, 149, 65, - -H27U1G8F2B, 2048, 131072, 134217728, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 241, 0, 29, -, - -H27U1G8F2C, 2048, 131072, 134217728, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 241, 128, 29, -, - -H27UBG8T2A, 8192, 2097152, 4294967295, 448, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 4, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 215, 148, 154, 116, 66 -K9GAG08U0E, 8192, 1048576, 2176843776, 436, 0, 25, 15, 15, 10, 10, 15, 15, 15, 5, 5, 5, 30, 30, 25, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 213, 132, 114, 80, 66 -K9LBG08U0E/K9HCG08U1E, 8192, 1048576, 2176843776, 436, 0, 25, 15, 15, 10, 10, 15, 15, 15, 5, 5, 5, 30, 30, 25, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 215, 197, 114, 84, 66 -K9F4G08U0B, 2048, 131072, 536870912, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 220, 16, 149, 84, 236 -K9F1208U0B, 512, 16384, 67108864, 16, 5, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 45, 50, 30, 3, 1, 0, -, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 118, 165, 192, -, - -K9G8G08U0A, 2048, 262144, 1073741824, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 211, 20, 165, 100, - -K9G4G08U0B, 2048, 262144, 536870912, 64, 0, 20, 15, 15, 10, 10, 15, 15, 15, 5, 5, 5, 30, 30, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 220, 20, 165, 84, 236 -K9G8G08U0M, 2048, 262144, 1073741824, 64, 0, 20, 15, 15, 10, 10, 15, 15, 15, 5, 5, 5, 30, 30, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 211, 20, 37, 100, - -NAND01GW3B, 2048, 131072, 1073741824, 64, 0, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 50, 50, 35, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 32, 241, -, -, -, - -NAND02GW3B, 2048, 131072, 1073741824, 64, 0, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 50, 50, 35, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 32, 218, -, -, -, - -NAND128W3A, 512, 16384, 1073741824, 16, 0, 0, 0, 0, 10, 10, 35, 30, 20, 10, 10, 10, 50, 50, 35, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 32, 115, -, -, -, - -HY27US08281A, 512, 16384, 16777216, 16, 5, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 50, 50, 30, 2, 1, 0, -, 80, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 115, -, -, -, - -HY27US08561A, 512, 16384, 33554432, 16, 5, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 50, 50, 30, 2, 1, 0, -, 80, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 117, -, -, -, - -HY27US08121B, 512, 16384, 67108864, 16, 5, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 50, 50, 30, 3, 1, 0, -, 80, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 118, -, -, -, - -TC58NVG0S3ETA00, 2048, 131072, 134217728, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 152, 209, 144, 21, 118, - -TC58NVG1S3ETA00, 2048, 131072, 268435456, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 152, 218, 144, 21, 118, 20 -TC58NVG1S3HTA00, 2048, 131072, 268435456, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 152, 218, 144, 21, 246, 22 -TC58NVG2S3ETA00, 2048, 131072, 536870912, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 152, 220, 144, 21, 118, - -F59L1G81A, 2048, 131072, 134217728, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 2, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 146, 241, 128, 149, 64, 127 -F59L2G81A, 2048, 131072, 268435456, 64, 0, 20, 12, 5, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 200, 218, 144, 149, 68, - -MT29F1G08ABAEA, 2048, 131072, 134217728, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, 239, 144, 8, 0, 44, 241, 128, 149, 4, 0 -MT29F2G08ABAEA, 2048, 131072, 268435456, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, 239, 144, 8, 0, 44, 218, 144, 149, -, - -MT29F4G08ABAD, 2048, 131072, 536870912, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, 239, 144, 8, 0, 44, 220, 144, 149, -, - -MX30LF1G18AC, 2048, 131072, 134217728, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 2, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 194, 241, 128, 149, 2, - -MX30LF2G18AC, 2048, 131072, 268435456, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 194, 218, 144, 149, 6, - -MX30LF2G189C, 2048, 131072, 268435456, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 194, 220, 144, 149, 86, - -S34ML01G1, 2048, 131072, 134217728, 64, 0, 20, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 1, 241, 0, 29, -, - -S34ML01G2, 2048, 131072, 134217728, 64, 0, 20, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 1, 241, 128, 0, 29, - -S34ML02G1, 2048, 131072, 268435456, 64, 0, 20, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 1, 218, 144, 149, 68, - -S34ML04G1, 2048, 131072, 536870912, 64, 0, 20, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 1, 220, 144, 149, 84, - -NAND512W3A2C, 2048, 131072, 536870912, 64, 0, 20, 15, 15, 15, 15, 15, 15, 15, 5, 5, 5, 30, 30, 18, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 1, 220, 144, 149, 84, - -W29N01HVSINA, 2048, 131072, 134217728, 64, 0, 15, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 2, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 239, 241, 0, 149, 0, - -W29N01GV, 2048, 131072, 134217728, 64, 0, 15, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 239, 241, 128, 149, 0, - -W29N02GVSIAA, 2048, 131072, 268435456, 64, 0, 15, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 239, 218, 16, 149, 6, 0 -W29N02GVSIAA-1, 2048, 131072, 268435456, 64, 0, 15, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 239, 218, 144, 149, 4, 0 +# name, page size, block size, total size, spare size, bad block mark off., tCS, tCLS, tALS, tCLR, tAR, tWP, tRP, tDS, tCH, tCLH, tALH, tWC, tRC, tREA, row cycles, col. cycles, read 1 cycle com., read 2 cycle com., read spare com., read ID com., reset com., write 1 cycle com., write 2 cycle com., erase 1 cycle com., erase 2 cycle com., status com., set feat. com., en. ECC addr, en. ECC val., dis. ECC val., ID1, ID2, ID3, ID4, ID5 +K9F2G08U0C, 2048, 131072, 268435456, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 218, 16, 149, 68 +K9F1G08U0E, 2048, 131072, 134217728, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 241, 0, 149, 65 +K9F1208U0B, 512, 16384, 67108864, 16, 5, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 45, 50, 30, 3, 1, 0, -, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 118, 165, 192, - +K9G8G08U0A, 2048, 262144, 1073741824, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 211, 20, 165, 100 +K9G8G08U0M, 2048, 262144, 1073741824, 64, 0, 20, 15, 15, 10, 10, 15, 15, 15, 5, 5, 5, 30, 30, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 211, 20, 37, 100 +K9F4G08U0A, 2048, 131072, 536870912, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 236, 220, 16, 149, 84 +HY27US08281A, 512, 16384, 16777216, 16, 5, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 50, 50, 30, 2, 1, 0, -, 80, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 115, -, -, - +HY27US08561A, 512, 16384, 33554432, 16, 5, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 50, 50, 30, 2, 1, 0, -, 80, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 117, -, -, - +HY27US08121B, 512, 16384, 67108864, 16, 5, 0, 0, 0, 10, 10, 25, 25, 20, 10, 10, 10, 50, 50, 30, 3, 1, 0, -, 80, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 173, 118, -, -, - +TC58NVG2S3E, 2048, 131072, 536870912, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 152, 220, 144, 21, 118 +TC58NVG1S3E, 2048, 131072, 268435456, 64, 0, 20, 12, 12, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 152, 218, 144, 21, 118 +F59L2G81A, 2048, 131072, 268435456, 64, 0, 20, 12, 5, 10, 10, 12, 12, 12, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 200, 218, 144, 149, 68 +MT29F2G08ABAEA, 2048, 131072, 268435456, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, 239, 144, 8, 0, 44, 218, 144, 149, - +MT29F4G08ABAD, 2048, 131072, 536870912, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, 239, 144, 8, 0, 44, 220, 144, 149, - +MX30LF2G18AC, 2048, 131072, 268435456, 64, 0, 15, 10, 10, 10, 10, 10, 10, 7, 5, 5, 5, 20, 20, 16, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 194, 218, 144, 149, 6 +S34ML01G1, 2048, 131072, 134217728, 64, 0, 20, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 1, 241, 0, 29, - +S34ML02G1, 2048, 131072, 268435456, 64, 0, 20, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 1, 218, 144, 149, 68 +S34ML04G1, 2048, 131072, 536870912, 64, 0, 20, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 25, 25, 20, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 1, 220, 144, 149, 84 +W29N02GZS1BA, 2048, 131072, 268435456, 64, 0, 20, 10, 10, 10, 10, 12, 12, 10, 5, 5, 5, 35, 35, 25, 3, 2, 0, 48, -, 144, 255, 128, 16, 96, 208, 112, -, -, -, -, 239, 170, 144, 21, 4 diff --git a/qt/nando_spi_chip_db.csv b/qt/nando_spi_chip_db.csv old mode 100755 new mode 100644 index 0216cb0..2c460a9 --- a/qt/nando_spi_chip_db.csv +++ b/qt/nando_spi_chip_db.csv @@ -3,4 +3,3 @@ AT45DB021D, 264, 2112, 270336, 9, 11, 159, 130, -, 80, 215, 7, 0, 66000, 31, 35, AT25SF041, 256, 4096, 524288, 8, 11, 159, 2, 6, 32, 5, 0, 1, 85000, 31, 132, 1, -, - MX25L8006E, 256, 4096, 1048576, 8, 11, 159, 2, 6, 32, 5, 0, 1, 86000, 194, 32, 20, -, - W25Q16JV, 256, 4096, 2097152, 8, 11, 159, 2, 6, 32, 5, 0, 1, 133000, 239, 64, 21, -, - -W25Q128JV, 256, 4096, 16777216, 8, 11, 159, 2, 6, 32, 5, 0, 1, 133000, 247, 160, 12, -, - diff --git a/qt/parallel_chip_db.cpp b/qt/parallel_chip_db.cpp index 9ea6e1e..0aec82f 100644 --- a/qt/parallel_chip_db.cpp +++ b/qt/parallel_chip_db.cpp @@ -26,7 +26,7 @@ ChipInfo *ParallelChipDb::stringToChipInfo(const QString &s) paramsList = s.split(','); paramNum = paramsList.size(); - if (paramNum < CHIP_PARAM_NUM) + if (paramNum != CHIP_PARAM_NUM) { QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Failed to read chip DB entry. Expected %2 parameters, " diff --git a/qt/programmer.cpp b/qt/programmer.cpp index 5d660f6..7a4d41f 100644 --- a/qt/programmer.cpp +++ b/qt/programmer.cpp @@ -8,14 +8,11 @@ #include #ifdef Q_OS_LINUX - #define USB_DEV_NAME "/dev/ttyACM0" - #define SERIAL_PORT_SPEED 4000000 -#elif defined(Q_OS_MAC) - #define USB_DEV_NAME "/dev/cu.usbmodem5700816939321" // Update this to the actual device path on macOS - #define SERIAL_PORT_SPEED 921600 + #define USB_DEV_NAME "/dev/ttyACM0" + #define SERIAL_PORT_SPEED 4000000 #else - #define USB_DEV_NAME "COM1" - #define SERIAL_PORT_SPEED 4000000 + #define USB_DEV_NAME "COM1" + #define SERIAL_PORT_SPEED 4000000 #endif #define READ_TIMEOUT_MS 100 diff --git a/qt/serial_port.cpp b/qt/serial_port.cpp index f3a3448..bb221b1 100644 --- a/qt/serial_port.cpp +++ b/qt/serial_port.cpp @@ -5,13 +5,6 @@ #include "serial_port.h" #include -#include - -#ifdef Q_OS_MAC - #include -#endif - - SerialPort::SerialPort() { @@ -154,41 +147,6 @@ void SerialPort::onTimeout(const boost::system::error_code &e) std::cerr << "Timer setup error: " << e.message() << std::endl; } -void set_speed(serial_port_ptr p, unsigned speed) -{ - // Retrieve the native file descriptor of the serial port - int fd = p->native_handle(); - - // Create a termios structure to hold the current terminal settings - struct termios t; - - // Get the current settings - if (tcgetattr(fd, &t) < 0) { - std::cerr << "Error getting terminal attributes" << std::endl; - return; // Handle error properly (e.g., return or throw exception) - } - - // Set baud rate (we assume `speed` is a valid integer baud rate) - // Using cfsetspeed works for standard baud rates, but if we need custom speeds, - // we must modify the termios structure directly. - speed_t baud_rate = static_cast(speed); - - // Validate and apply the speed - if (cfsetspeed(&t, baud_rate) < 0) { - std::cerr << "Error setting baud rate to " << speed << std::endl; - return; // Handle error properly (e.g., return or throw exception) - } - - // Apply the changes immediately - if (tcsetattr(fd, TCSANOW, &t) < 0) { - std::cerr << "Error applying terminal attributes" << std::endl; - return; // Handle error properly (e.g., return or throw exception) - } - - std::cout << "Speed changed to " << speed << " successfully." << std::endl; -} - - bool SerialPort::start(const char *portName, int baudRate) { boost::system::error_code ec; @@ -209,12 +167,7 @@ bool SerialPort::start(const char *portName, int baudRate) return false; } -#ifdef Q_OS_MAC - set_speed(port,baudRate);//To get higher baudrate for OSX -#else port->set_option(boost::asio::serial_port_base::baud_rate(baudRate)); -#endif - port->set_option(boost::asio::serial_port_base::character_size(8)); port->set_option(boost::asio::serial_port_base:: stop_bits(boost::asio::serial_port_base::stop_bits::one));