freertos demo use static only for most optmized sram

This commit is contained in:
hathach 2020-03-11 00:09:37 +07:00
parent 65578dec44
commit 487b887f80
10 changed files with 66 additions and 12 deletions

View File

@ -19,7 +19,6 @@ SRC_C += \
$(FREERTOS_SRC)/queue.c \
$(FREERTOS_SRC)/tasks.c \
$(FREERTOS_SRC)/timers.c \
$(FREERTOS_SRC)/portable/MemMang/heap_4.c \
$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/port.c
# FreeRTOS (lto + Os) linker issue

View File

@ -45,10 +45,60 @@
// for OPT_MCU_
#include "tusb_option.h"
#if CFG_TUSB_MCU == OPT_MCU_NRF5X
#if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13XX || \
CFG_TUSB_MCU == OPT_MCU_LPC15XX || CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || \
CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC18XX || \
CFG_TUSB_MCU == OPT_MCU_LPC40XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX
#include "chip.h"
#elif CFG_TUSB_MCU == OPT_MCU_LPC51UXX || CFG_TUSB_MCU == OPT_MCU_LPC54XXX || \
CFG_TUSB_MCU == OPT_MCU_LPC55XX
#include "fsl_device_registers.h"
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
#include "nrf.h"
#elif CFG_TUSB_MCU == OPT_MCU_SAMD21 || CFG_TUSB_MCU == OPT_MCU_SAMD51
#elif CFG_TUSB_MCU == OPT_MCU_SAMD21 || CFG_TUSB_MCU == OPT_MCU_SAMD51 || \
CFG_TUSB_MCU == OPT_MCU_SAMG
#include "sam.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32F0
#include "stm32f0xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
#include "stm32f1xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32F2
#include "stm32f2xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32F3
#include "stm32f3xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32F4
#include "stm32f4xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32F7
#include "stm32f7xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32H7
#include "stm32h7xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32L0
#include "stm32l0xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32L1
#include "stm32l1xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_STM32L4
#include "stm32l4xx.h"
#elif CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
#include "fsl_device_registers.h"
#elif CFG_TUSB_MCU == OPT_MCU_NUC120 || CFG_TUSB_MCU == OPT_MCU_NUC121 || \
CFG_TUSB_MCU == OPT_MCU_NUC126 || CFG_TUSB_MCU == OPT_MCU_NUC505
#include "NuMicro.h"
#else
#error "FreeRTOSConfig.h need to include low level mcu header for configuration"
#endif
@ -59,7 +109,7 @@
#define configTICK_RATE_HZ ( 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( 128 )
#define configTOTAL_HEAP_SIZE ( 4*1024 )
#define configTOTAL_HEAP_SIZE ( 0*1024 ) // dynamic is not used
#define configMAX_TASK_NAME_LEN 16
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
@ -73,7 +123,7 @@
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 0
/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 0

View File

@ -51,13 +51,16 @@ enum {
BLINK_SUSPENDED = 2500,
};
// static timer
StaticTimer_t static_blink;
TimerHandle_t blink_tm;
// static task
// static task for usbd
#define USBD_STACK_SIZE 150
StackType_t stack_usbd[USBD_STACK_SIZE];
StaticTask_t static_task_usbd;
// static task for cdc
#define CDC_STACK_SZIE 128
StackType_t stack_cdc[CDC_STACK_SZIE];
StaticTask_t static_task_cdc;
@ -73,7 +76,7 @@ int main(void)
board_init();
// soft timer for blinky
blink_tm = xTimerCreate(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb);
blink_tm = xTimerCreateStatic(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb, &static_blink);
xTimerStart(blink_tm, 0);
tusb_init();

View File

@ -35,7 +35,7 @@ VENDOR = nxp
CHIP_FAMILY = transdimension
# For freeRTOS port source
FREERTOS_PORT = ARM_CM4
FREERTOS_PORT = ARM_CM4F
# For flash-jlink target
JLINK_DEVICE = LPC4357

View File

@ -25,6 +25,9 @@ INC += \
VENDOR = valentyusb
CHIP_FAMILY = eptri
# For freeRTOS port source
FREERTOS_PORT = RISC-V
# flash using dfu-util
flash: $(BUILD)/$(BOARD)-firmware.dfu
dfu-util -D $^

View File

@ -39,7 +39,7 @@ VENDOR = nxp
CHIP_FAMILY = lpc_ip3511
# For freeRTOS port source
FREERTOS_PORT = ARM_CM4
FREERTOS_PORT = ARM_CM4F
# For flash-jlink target
JLINK_DEVICE = LPC54114J256_M4

View File

@ -33,7 +33,7 @@ VENDOR = nxp
CHIP_FAMILY = transdimension
# For freeRTOS port source
FREERTOS_PORT = ARM_CM4
FREERTOS_PORT = ARM_CM4F
# For flash-jlink target
JLINK_DEVICE = LPC4330

View File

@ -40,7 +40,7 @@ VENDOR = nuvoton
CHIP_FAMILY = nuc505
# For freeRTOS port source
FREERTOS_PORT = ARM_CM4
FREERTOS_PORT = ARM_CM4F
# For flash-jlink target
JLINK_DEVICE = NUC505YO13Y

View File

@ -42,7 +42,6 @@
#define BUTTON_PIN GPIO(GPIO_PORTA, 2)
#define BUTTON_STATE_ACTIVE 0
#define UART_TX_PIN GPIO(GPIO_PORTA, 28)
#define UART_RX_PIN GPIO(GPIO_PORTA, 27)