Skip to content

Commit 3aa7aa0

Browse files
committed
Reduced ram allocation for some tasks
1 parent 0eadd90 commit 3aa7aa0

8 files changed

Lines changed: 15 additions & 13 deletions

File tree

Firmware/FFBoard/Src/CommandInterface.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ void CDC_CommandInterface::sendReplies(const std::vector<CommandResult>& results
297297
void CDC_CommandInterface::batchDone(){
298298
if(resultsBuffer.empty())
299299
return;
300-
Notify();
301300
resultsBuffer.shrink_to_fit();
301+
Notify();
302302
}
303303

304304
/**
@@ -324,7 +324,7 @@ bool CDC_CommandInterface::readyToSend(){
324324
*/
325325

326326
extern UARTPort external_uart; // defined in cpp_target_config.cpp
327-
UART_CommandInterface::UART_CommandInterface(uint32_t baud) : UARTDevice(external_uart),Thread("UARTCMD", 256, 36),StringCommandInterface(512), baud(baud){ //
327+
UART_CommandInterface::UART_CommandInterface(uint32_t baud) : UARTDevice(external_uart),Thread("UARTCMD", 150, 36),StringCommandInterface(512), baud(baud){ //
328328
uartconfig = uartport->getConfig();
329329
if(baud != 0){
330330
uartconfig.BaudRate = this->baud;
@@ -399,7 +399,7 @@ void UART_CommandInterface::uartRcv(char& buf){
399399
void UART_CommandInterface::batchDone(){
400400
if(resultsBuffer.empty())
401401
return;
402-
Notify();
403402
resultsBuffer.shrink_to_fit();
403+
Notify();
404404
}
405405

Firmware/FFBoard/Src/HidCommandInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
HID_CommandInterface* HID_CommandInterface::globalInterface = nullptr;
22-
HID_CommandInterface::HID_CommandInterface() : cpp_freertos::Thread("HIDCMD",256,18){
22+
HID_CommandInterface::HID_CommandInterface() : cpp_freertos::Thread("HIDCMD",128,18){
2323
globalInterface = this;
2424
this->Start();
2525
}

Firmware/FFBoard/Src/USBdevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
uint16_t _desc_str[USB_STRING_DESC_BUF_SIZE]; // String buffer
1212

1313
USBdevice::USBdevice(const tusb_desc_device_t* deviceDesc,const uint8_t (*confDesc),const usb_string_desc_t* strings) :
14-
Thread("USB", 350, 40), desc_device(deviceDesc), desc_conf(confDesc), string_desc(strings) {
14+
Thread("USB", 256, 40), desc_device(deviceDesc), desc_conf(confDesc), string_desc(strings) {
1515

1616
}
1717

Firmware/FFBoard/UserExtensions/Src/EncoderBissC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const ClassIdentifier EncoderBissC::getInfo(){
2424
EncoderBissC::EncoderBissC() :
2525
SPIDevice(ENCODER_SPI_PORT, ENCODER_SPI_PORT.getCsPins()[0]),
2626
CommandHandler("bissenc",CLSID_ENCODER_BISS,0),
27-
cpp_freertos::Thread("BISSENC",256,42) {
27+
cpp_freertos::Thread("BISSENC",64,42) {
2828
EncoderBissC::inUse = true;
2929

3030

Firmware/FFBoard/UserExtensions/Src/TMC4671.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2873,7 +2873,7 @@ void TMC4671::setUpExtEncTimer(){
28732873
/**
28742874
* Medium priority task to update external encoders
28752875
*/
2876-
TMC4671::TMC_ExternalEncoderUpdateThread::TMC_ExternalEncoderUpdateThread(TMC4671* tmc) : cpp_freertos::Thread("TMCENC",128,33),tmc(tmc){
2876+
TMC4671::TMC_ExternalEncoderUpdateThread::TMC_ExternalEncoderUpdateThread(TMC4671* tmc) : cpp_freertos::Thread("TMCENC",80,33),tmc(tmc){
28772877
this->Start();
28782878
}
28792879

Firmware/Targets/F407VG/Core/Inc/FreeRTOSConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
#define configCPU_CLOCK_HZ ( SystemCoreClock )
6868
#define configTICK_RATE_HZ ((TickType_t)1000)
6969
#define configMAX_PRIORITIES ( 56 )
70-
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
70+
#define configMINIMAL_STACK_SIZE ((uint16_t)64)
7171
#define configTOTAL_HEAP_SIZE ((size_t)0xffff)
7272
#define configMAX_TASK_NAME_LEN ( 16 )
7373
#define configUSE_TRACE_FACILITY 1
@@ -94,7 +94,7 @@
9494
#define configUSE_TIMERS 1
9595
#define configTIMER_TASK_PRIORITY ( 2 )
9696
#define configTIMER_QUEUE_LENGTH 10
97-
#define configTIMER_TASK_STACK_DEPTH 256
97+
#define configTIMER_TASK_STACK_DEPTH 128
9898

9999
/* The following flag must be enabled only when using newlib */
100100
#define configUSE_NEWLIB_REENTRANT 1

Firmware/Targets/F407VG/Core/Src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PCD_HandleTypeDef hpcd_USB_OTG_FS;
8383
osThreadId_t defaultTaskHandle;
8484
const osThreadAttr_t defaultTask_attributes = {
8585
.name = "defaultTask",
86-
.stack_size = 1024 * 4,
86+
.stack_size = 512 * 4,
8787
.priority = (osPriority_t) osPriorityBelowNormal,
8888
};
8989
/* USER CODE BEGIN PV */

Firmware/Targets/F407VG/OpenFFBoard_F407VG.ioc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,14 @@ Dma.SPI3_TX.7.Priority=DMA_PRIORITY_MEDIUM
163163
Dma.SPI3_TX.7.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
164164
FREERTOS.FootprintOK=true
165165
FREERTOS.HEAP_NUMBER=4
166-
FREERTOS.IPParameters=Tasks01,configENABLE_FPU,configTOTAL_HEAP_SIZE,FootprintOK,configUSE_NEWLIB_REENTRANT,HEAP_NUMBER,configUSE_IDLE_HOOK,configUSE_MALLOC_FAILED_HOOK,configCHECK_FOR_STACK_OVERFLOW,configGENERATE_RUN_TIME_STATS,configRECORD_STACK_HIGH_ADDRESS,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_TRACE_FACILITY
167-
FREERTOS.Tasks01=defaultTask,16,1024,StartDefaultTask,As weak,NULL,Dynamic,NULL,NULL
166+
FREERTOS.IPParameters=Tasks01,configENABLE_FPU,configTOTAL_HEAP_SIZE,FootprintOK,configUSE_NEWLIB_REENTRANT,HEAP_NUMBER,configUSE_IDLE_HOOK,configUSE_MALLOC_FAILED_HOOK,configCHECK_FOR_STACK_OVERFLOW,configGENERATE_RUN_TIME_STATS,configRECORD_STACK_HIGH_ADDRESS,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_TRACE_FACILITY,configTIMER_TASK_STACK_DEPTH,configMINIMAL_STACK_SIZE
167+
FREERTOS.Tasks01=defaultTask,16,512,StartDefaultTask,As weak,NULL,Dynamic,NULL,NULL
168168
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=2
169169
FREERTOS.configENABLE_FPU=1
170170
FREERTOS.configGENERATE_RUN_TIME_STATS=0
171+
FREERTOS.configMINIMAL_STACK_SIZE=64
171172
FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1
173+
FREERTOS.configTIMER_TASK_STACK_DEPTH=128
172174
FREERTOS.configTOTAL_HEAP_SIZE=0xffff
173175
FREERTOS.configUSE_IDLE_HOOK=1
174176
FREERTOS.configUSE_MALLOC_FAILED_HOOK=1
@@ -717,7 +719,7 @@ ProjectManager.FreePins=false
717719
ProjectManager.HalAssertFull=false
718720
ProjectManager.HeapSize=0x400
719721
ProjectManager.KeepUserCode=true
720-
ProjectManager.LastFirmware=true
722+
ProjectManager.LastFirmware=false
721723
ProjectManager.LibraryCopy=1
722724
ProjectManager.MainLocation=Core/Src
723725
ProjectManager.MultiThreaded=true

0 commit comments

Comments
 (0)