diff --git a/CMakeLists.txt b/CMakeLists.txt index f774839..5a3a291 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ target_include_directories(lwip PUBLIC ${LWIP_INCLUDE_DIRS}) # Add freeRTOS set(FREERTOS_PORT GCC_ARM_CA9 CACHE STRING "") -set(FREERTOS_HEAP 2 CACHE STRING "") +set(FREERTOS_HEAP 1 CACHE STRING "") add_library(freertos_config INTERFACE) target_include_directories(freertos_config SYSTEM INTERFACE ${FreeRTOS_CONFIG_PATH}) # The config file directory diff --git a/bsp_z7/freeRTOS/FreeRTOSConfig.h b/bsp_z7/freeRTOS/FreeRTOSConfig.h index b8c70c9..e667c02 100644 --- a/bsp_z7/freeRTOS/FreeRTOSConfig.h +++ b/bsp_z7/freeRTOS/FreeRTOSConfig.h @@ -77,9 +77,9 @@ #define configUSE_TICK_HOOK 1 #define configMAX_PRIORITIES ( 7 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 250 ) /* Large in case configUSE_TASK_FPU_SUPPORT is 2 in which case all tasks have an FPU context. */ -#define configTOTAL_HEAP_SIZE ( 0 ) +#define configTOTAL_HEAP_SIZE ( 204800 ) #define configMAX_TASK_NAME_LEN ( 10 ) -#define configUSE_TRACE_FACILITY 1 +#define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 #define configUSE_MUTEXES 1 @@ -89,8 +89,8 @@ #define configUSE_APPLICATION_TASK_TAG 0 #define configUSE_COUNTING_SEMAPHORES 1 #define configUSE_QUEUE_SETS 1 -#define configSUPPORT_STATIC_ALLOCATION 1 -#define configSUPPORT_DYNAMIC_ALLOCATION 0 +#define configSUPPORT_STATIC_ALLOCATION 0 +#define configSUPPORT_DYNAMIC_ALLOCATION 1 /* Include the query-heap CLI command to query the free heap space. */ #define configINCLUDE_QUERY_HEAP_COMMAND 0 diff --git a/mission/freeRTOS_rust_helper.c b/mission/freeRTOS_rust_helper.c index 3cbaccf..265965a 100644 --- a/mission/freeRTOS_rust_helper.c +++ b/mission/freeRTOS_rust_helper.c @@ -2,7 +2,7 @@ #include "semphr.h" #include "task.h" -//TODO namespace the names +// TODO namespace the names /** * Task descriptors diff --git a/mission/main.c b/mission/main.c index 2d7b563..7fdb6f7 100644 --- a/mission/main.c +++ b/mission/main.c @@ -137,7 +137,7 @@ int main(void) { int taskParameters = 0; - static const uint16_t stackSizeWords = 512; + static const size_t stackSizeWords = 102400; StaticTask_t xTaskBuffer; StackType_t xStack[stackSizeWords]; diff --git a/mission_rust/src/lib.rs b/mission_rust/src/lib.rs index bf55d45..3396bcd 100644 --- a/mission_rust/src/lib.rs +++ b/mission_rust/src/lib.rs @@ -116,10 +116,11 @@ impl<'a> PeriodicTaskRunner<'a> { fn execute(&mut self) { sifln!("Task Runner {}", self.period); loop { - self.task_object.perform(); - unsafe { - task_delay(self.period); - } + // self.task_object.perform(); + // unsafe { + // task_delay(self.period); + // } + unsafe { task_delay(200) }; } } } @@ -136,7 +137,12 @@ impl<'a, const STACKSIZE: usize> PeriodicTask<'a, STACKSIZE> { }; let runner_pointer: *mut cty::c_void = &mut instance.runner as *mut _ as *mut cty::c_void; let stack_pointer: *mut cty::c_void = &mut instance.stack as *mut _ as *mut cty::c_void; - sifln!("giving pointer {:p} {:p}", runner_pointer, &mut instance.runner as *mut PeriodicTaskRunner); + sifln!( + "giving pointer {:p} {:p}, instance {:p}", + runner_pointer, + &mut instance.runner as *mut PeriodicTaskRunner, + &instance as *const Self + ); unsafe { instance.task = create_task(task_entry, runner_pointer, stack_pointer, STACKSIZE); } @@ -208,7 +214,7 @@ struct MessageQueue { struct MessageQueueSender { queue_id: Option<*const cty::c_void>, - _unused: Option //need to constrain the sender to one message type for safety, but compiler needs that to be used + _unused: Option, //need to constrain the sender to one message type for safety, but compiler needs that to be used } impl MessageQueue { @@ -233,7 +239,7 @@ impl MessageQueue { fn get_sender(&self) -> MessageQueueSender { let instance: MessageQueueSender = MessageQueueSender:: { queue_id: Some(self.queue_id), - _unused: None + _unused: None, }; instance } @@ -258,7 +264,7 @@ impl MessageQueueSender { fn new() -> Self { Self { queue_id: None, - _unused: None + _unused: None, } } @@ -305,7 +311,6 @@ impl Write for Outbytes { } } - fn mission() { sifln!("Mission enter"); @@ -323,7 +328,13 @@ fn mission() { let mut _t1: PeriodicTask<'_, 512> = PeriodicTask::new(&mut h1); - sifln!("mission pointer {:p}", &mut _t1.runner as *mut PeriodicTaskRunner); + sifln!( + "mission pointer {:p} {:p} {} {:p}", + &_t1 as *const PeriodicTask<512>, + &mut _t1.runner as *mut PeriodicTaskRunner, + core::mem::size_of::(), + &_t1.stack as *const _ + ); //let _t2: PeriodicTask<'_, 512> = PeriodicTask::new(&mut h2);