Skip to content

Commit 0d690c8

Browse files
committed
update nuc121/125
1 parent 9bd3622 commit 0d690c8

File tree

11 files changed

+184
-34
lines changed

11 files changed

+184
-34
lines changed

examples/device/audio_4_channel_mic_freertos/skip.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ board:lpcxpresso11u37
1717
board:lpcxpresso1347
1818
family:broadcom_32bit
1919
family:broadcom_64bit
20+
family:nuc121_125

examples/device/audio_test_freertos/skip.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ mcu:RAXXX
1515
family:broadcom_32bit
1616
family:broadcom_64bit
1717
board:stm32l0538disco
18+
family:nuc121_125

examples/device/cdc_msc_freertos/skip.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ mcu:RAXXX
1515
mcu:STM32L0
1616
family:broadcom_32bit
1717
family:broadcom_64bit
18+
family:nuc121_125
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
* FreeRTOS Kernel V10.0.0
3+
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software. If you wish to use our Amazon
14+
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
*
23+
* http://www.FreeRTOS.org
24+
* http://aws.amazon.com/freertos
25+
*
26+
* 1 tab == 4 spaces!
27+
*/
28+
29+
30+
#ifndef FREERTOS_CONFIG_H
31+
#define FREERTOS_CONFIG_H
32+
33+
/*-----------------------------------------------------------
34+
* Application specific definitions.
35+
*
36+
* These definitions should be adjusted for your particular hardware and
37+
* application requirements.
38+
*
39+
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
40+
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
41+
*
42+
* See http://www.freertos.org/a00110.html.
43+
*----------------------------------------------------------*/
44+
45+
// skip if included from IAR assembler
46+
#ifndef __IASMARM__
47+
#include "NuMicro.h"
48+
#endif
49+
50+
/* Cortex-M0 port configuration. */
51+
#define configENABLE_MPU 0
52+
#define configENABLE_FPU 0
53+
#define configENABLE_TRUSTZONE 0
54+
#define configMINIMAL_SECURE_STACK_SIZE (1024)
55+
56+
#define configUSE_PREEMPTION 1
57+
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
58+
#define configCPU_CLOCK_HZ SystemCoreClock
59+
#define configTICK_RATE_HZ ( 1000 )
60+
#define configMAX_PRIORITIES ( 5 )
61+
#define configMINIMAL_STACK_SIZE ( 128 )
62+
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
63+
#define configMAX_TASK_NAME_LEN 16
64+
#define configUSE_16_BIT_TICKS 0
65+
#define configIDLE_SHOULD_YIELD 1
66+
#define configUSE_MUTEXES 1
67+
#define configUSE_RECURSIVE_MUTEXES 1
68+
#define configUSE_COUNTING_SEMAPHORES 1
69+
#define configQUEUE_REGISTRY_SIZE 4
70+
#define configUSE_QUEUE_SETS 0
71+
#define configUSE_TIME_SLICING 0
72+
#define configUSE_NEWLIB_REENTRANT 0
73+
#define configENABLE_BACKWARD_COMPATIBILITY 1
74+
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
75+
76+
#define configSUPPORT_STATIC_ALLOCATION 1
77+
#define configSUPPORT_DYNAMIC_ALLOCATION 0
78+
79+
/* Hook function related definitions. */
80+
#define configUSE_IDLE_HOOK 0
81+
#define configUSE_TICK_HOOK 0
82+
#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
83+
#define configCHECK_FOR_STACK_OVERFLOW 2
84+
#define configCHECK_HANDLER_INSTALLATION 0
85+
86+
/* Run time and task stats gathering related definitions. */
87+
#define configGENERATE_RUN_TIME_STATS 0
88+
#define configRECORD_STACK_HIGH_ADDRESS 1
89+
#define configUSE_TRACE_FACILITY 1 // legacy trace
90+
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
91+
92+
/* Co-routine definitions. */
93+
#define configUSE_CO_ROUTINES 0
94+
#define configMAX_CO_ROUTINE_PRIORITIES 2
95+
96+
/* Software timer related definitions. */
97+
#define configUSE_TIMERS 1
98+
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
99+
#define configTIMER_QUEUE_LENGTH 32
100+
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
101+
102+
/* Optional functions - most linkers will remove unused functions anyway. */
103+
#define INCLUDE_vTaskPrioritySet 0
104+
#define INCLUDE_uxTaskPriorityGet 0
105+
#define INCLUDE_vTaskDelete 0
106+
#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
107+
#define INCLUDE_xResumeFromISR 0
108+
#define INCLUDE_vTaskDelayUntil 1
109+
#define INCLUDE_vTaskDelay 1
110+
#define INCLUDE_xTaskGetSchedulerState 0
111+
#define INCLUDE_xTaskGetCurrentTaskHandle 1
112+
#define INCLUDE_uxTaskGetStackHighWaterMark 0
113+
#define INCLUDE_xTaskGetIdleTaskHandle 0
114+
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
115+
#define INCLUDE_pcTaskGetTaskName 0
116+
#define INCLUDE_eTaskGetState 0
117+
#define INCLUDE_xEventGroupSetBitFromISR 0
118+
#define INCLUDE_xTimerPendFunctionCall 0
119+
120+
/* FreeRTOS hooks to NVIC vectors */
121+
#define xPortPendSVHandler PendSV_Handler
122+
#define xPortSysTickHandler SysTick_Handler
123+
#define vPortSVCHandler SVC_Handler
124+
125+
//--------------------------------------------------------------------+
126+
// Interrupt nesting behavior configuration.
127+
//--------------------------------------------------------------------+
128+
129+
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in mcu header
130+
// NUC121/125 has 2 priority bits
131+
#define configPRIO_BITS 2
132+
133+
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
134+
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
135+
136+
/* The highest interrupt priority that can be used by any interrupt service
137+
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
138+
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
139+
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
140+
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
141+
142+
/* Interrupt priorities used by the kernel port layer itself. These are generic
143+
to all Cortex-M ports, and do not rely on any particular library functions. */
144+
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
145+
146+
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
147+
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
148+
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
149+
150+
#endif

hw/bsp/nuc121_125/boards/nutiny_sdk_nuc121/board.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ set(NUC_SERIES nuc121)
22
set(JLINK_DEVICE NUC121SC2AE)
33
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/nuc121_flash.ld)
44

5-
# Extra StdDriver sources for NUC121
6-
set(BOARD_SOURCES
7-
${SDK_DIR}/StdDriver/src/fmc.c
8-
${SDK_DIR}/StdDriver/src/sys.c
9-
${SDK_DIR}/StdDriver/src/timer.c
10-
)
11-
125
function(update_board TARGET)
136
target_compile_definitions(${TARGET} PUBLIC
147
)
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
NUC_SERIES = nuc121
22
JLINK_DEVICE = NUC121SC2AE
33
LD_FILE = $(BOARD_PATH)/nuc121_flash.ld
4-
5-
# Extra StdDriver sources for NUC121
6-
SRC_C += \
7-
hw/mcu/nuvoton/nuc121_125/StdDriver/src/fmc.c \
8-
hw/mcu/nuvoton/nuc121_125/StdDriver/src/sys.c \
9-
hw/mcu/nuvoton/nuc121_125/StdDriver/src/timer.c
10-
11-
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
12-
# Please compile and install it from github source
13-
flash: $(BUILD)/$(PROJECT).elf
14-
openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< reset exit"
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
NUC_SERIES = nuc125
22
JLINK_DEVICE = NUC125SC2AE
33
LD_FILE = $(BOARD_PATH)/nuc125_flash.ld
4-
5-
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
6-
# Please compile and install it from github source
7-
flash: $(BUILD)/$(PROJECT).elf
8-
openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< reset exit"

hw/bsp/nuc121_125/family.cmake

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set(CMAKE_SYSTEM_CPU cortex-m0 CACHE INTERNAL "System Processor")
1111
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
1212
set(OPENOCD_OPTION "-f interface/nulink.cfg -f target/numicroM0.cfg")
1313

14-
set(FAMILY_MCUS NUC121 NUC125 CACHE INTERNAL "")
14+
set(FAMILY_MCUS NUC121 CACHE INTERNAL "")
1515

1616
#------------------------------------
1717
# BOARD_TARGET
@@ -31,20 +31,16 @@ function(add_board_target BOARD_TARGET)
3131
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
3232

3333
# Common sources for all NUC12x
34-
set(COMMON_SOURCES
34+
add_library(${BOARD_TARGET} STATIC
3535
${SDK_DIR}/Device/Nuvoton/NUC121/Source/system_NUC121.c
3636
${SDK_DIR}/StdDriver/src/clk.c
3737
${SDK_DIR}/StdDriver/src/gpio.c
38+
${SDK_DIR}/StdDriver/src/fmc.c
39+
${SDK_DIR}/StdDriver/src/sys.c
40+
${SDK_DIR}/StdDriver/src/timer.c
3841
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
3942
)
4043

41-
# Add board-specific sources if defined
42-
if(DEFINED BOARD_SOURCES)
43-
list(APPEND COMMON_SOURCES ${BOARD_SOURCES})
44-
endif()
45-
46-
add_library(${BOARD_TARGET} STATIC ${COMMON_SOURCES})
47-
4844
target_include_directories(${BOARD_TARGET} PUBLIC
4945
${SDK_DIR}/Device/Nuvoton/NUC121/Include
5046
${SDK_DIR}/StdDriver/inc

hw/bsp/nuc121_125/family.mk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ SRC_C += \
2626
src/portable/nuvoton/nuc121/dcd_nuc121.c \
2727
hw/mcu/nuvoton/nuc121_125/Device/Nuvoton/NUC121/Source/system_NUC121.c \
2828
hw/mcu/nuvoton/nuc121_125/StdDriver/src/clk.c \
29-
hw/mcu/nuvoton/nuc121_125/StdDriver/src/gpio.c
29+
hw/mcu/nuvoton/nuc121_125/StdDriver/src/gpio.c \
30+
hw/mcu/nuvoton/nuc121_125/StdDriver/src/fmc.c \
31+
hw/mcu/nuvoton/nuc121_125/StdDriver/src/sys.c \
32+
hw/mcu/nuvoton/nuc121_125/StdDriver/src/timer.c
3033

3134
# Additional sources are added in board.mk if needed (e.g., fmc, sys, timer, uart for NUC121)
3235

@@ -41,3 +44,9 @@ INC += \
4144

4245
# For freeRTOS port source
4346
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0
47+
48+
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
49+
# Please compile and install it from github source
50+
OPENOCD_NUVOTON_PATH ?= $(HOME)/app/OpenOCD-Nuvoton
51+
flash: $(BUILD)/$(PROJECT).elf
52+
$(OPENOCD_NUVOTON_PATH)/src/openocd -s $(OPENOCD_NUVOTON_PATH)/tcl -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< reset exit"

src/common/tusb_mcu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@
382382
//--------------------------------------------------------------------+
383383
#elif TU_CHECK_MCU(OPT_MCU_NUC121, OPT_MCU_NUC126)
384384
#define TUP_DCD_ENDPOINT_MAX 8
385+
#define TUP_DCD_EDPT_ISO_ALLOC
385386

386387
#elif TU_CHECK_MCU(OPT_MCU_NUC120)
387388
#define TUP_DCD_ENDPOINT_MAX 6

0 commit comments

Comments
 (0)