2020-02-07 20:11:00 -06:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CFLAGS += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  -flto \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  -mthumb \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  -mabi=aapcs-linux \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  -mcpu=cortex-m4 \
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-11 00:58:28 +07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  -mfloat-abi=hard \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  -mfpu=fpv4-sp-d16 \
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-07 20:11:00 -06:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  -DCFG_TUSB_MCU=OPT_MCU_NUC505
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# All source paths should be relative to the top level.
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-07 17:49:30 +07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								LD_FILE = hw/bsp/$(BOARD)/nuc505_flashtoram.ld
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-07 20:11:00 -06:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								SRC_C += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/Device/Nuvoton/NUC505Series/Source/system_NUC505Series.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/adc.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/clk.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/gpio.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/i2c.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/i2s.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/pwm.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/rtc.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/spi.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/spim.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/sys.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/timer.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/uart.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/wdt.c \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/StdDriver/src/wwdt.c
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								SRC_S += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  hw/mcu/nuvoton/nuc505/Device/Nuvoton/NUC505Series/Source/GCC/startup_NUC505Series.S
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								INC += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  $(TOP)/hw/mcu/nuvoton/nuc505/Device/Nuvoton/NUC505Series/Include \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  $(TOP)/hw/mcu/nuvoton/nuc505/StdDriver/inc \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  $(TOP)/hw/mcu/nuvoton/nuc505/CMSIS/Include
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# For TinyUSB port source
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								VENDOR = nuvoton
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CHIP_FAMILY = nuc505
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# For freeRTOS port source
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-11 00:09:37 +07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								FREERTOS_PORT = ARM_CM4F
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-07 20:11:00 -06:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# For flash-jlink target
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								JLINK_DEVICE = NUC505YO13Y
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-16 20:44:06 +07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Note
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# To be able to program the SPI flash, it need to boot with ICP mode "1011". 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# However, in ICP mode, opencod cannot establish connection to the mcu. 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Therefore, there is no easy command line flash for NUC505
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# It is probably better to just use Nuvoton NuMicro ICP programming on windows to program the board
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# - 1111 "SPI" (run from internal flash)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# - 1110 "USB" (mass storage emulator that accepts a .bin file)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# - 0111 "ICE-SPI" (allow external debugger access, but may not be programmable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# - 1011 ICP mode (programmable via NuMicro ICP programming tool)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-07 20:11:00 -06:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Please compile and install it from github source
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-26 12:46:24 +07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								flash: $(BUILD)/$(PROJECT).elf
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-07 20:11:00 -06:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									openocd -f interface/nulink.cfg -f target/numicroM4.cfg -c "program $< reset exit"
							 |