too static, does not work

This commit is contained in:
Ulrich Mohr 2023-11-20 16:49:52 +01:00
parent e1f250e8f7
commit c08d15215b
5 changed files with 28 additions and 17 deletions

View File

@ -60,7 +60,7 @@ target_include_directories(lwip PUBLIC ${LWIP_INCLUDE_DIRS})
# Add freeRTOS # Add freeRTOS
set(FREERTOS_PORT GCC_ARM_CA9 CACHE STRING "") 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) add_library(freertos_config INTERFACE)
target_include_directories(freertos_config SYSTEM target_include_directories(freertos_config SYSTEM
INTERFACE ${FreeRTOS_CONFIG_PATH}) # The config file directory INTERFACE ${FreeRTOS_CONFIG_PATH}) # The config file directory

View File

@ -77,9 +77,9 @@
#define configUSE_TICK_HOOK 1 #define configUSE_TICK_HOOK 1
#define configMAX_PRIORITIES ( 7 ) #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 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 configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 1 #define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
@ -89,8 +89,8 @@
#define configUSE_APPLICATION_TASK_TAG 0 #define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1 #define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_QUEUE_SETS 1 #define configUSE_QUEUE_SETS 1
#define configSUPPORT_STATIC_ALLOCATION 1 #define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 0 #define configSUPPORT_DYNAMIC_ALLOCATION 1
/* Include the query-heap CLI command to query the free heap space. */ /* Include the query-heap CLI command to query the free heap space. */
#define configINCLUDE_QUERY_HEAP_COMMAND 0 #define configINCLUDE_QUERY_HEAP_COMMAND 0

View File

@ -2,7 +2,7 @@
#include "semphr.h" #include "semphr.h"
#include "task.h" #include "task.h"
//TODO namespace the names // TODO namespace the names
/** /**
* Task descriptors * Task descriptors

View File

@ -137,7 +137,7 @@ int main(void) {
int taskParameters = 0; int taskParameters = 0;
static const uint16_t stackSizeWords = 512; static const size_t stackSizeWords = 102400;
StaticTask_t xTaskBuffer; StaticTask_t xTaskBuffer;
StackType_t xStack[stackSizeWords]; StackType_t xStack[stackSizeWords];

View File

@ -116,10 +116,11 @@ impl<'a> PeriodicTaskRunner<'a> {
fn execute(&mut self) { fn execute(&mut self) {
sifln!("Task Runner {}", self.period); sifln!("Task Runner {}", self.period);
loop { loop {
self.task_object.perform(); // self.task_object.perform();
unsafe { // unsafe {
task_delay(self.period); // 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 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; 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 { unsafe {
instance.task = create_task(task_entry, runner_pointer, stack_pointer, STACKSIZE); instance.task = create_task(task_entry, runner_pointer, stack_pointer, STACKSIZE);
} }
@ -208,7 +214,7 @@ struct MessageQueue<T, const LENGTH: usize> {
struct MessageQueueSender<T> { struct MessageQueueSender<T> {
queue_id: Option<*const cty::c_void>, queue_id: Option<*const cty::c_void>,
_unused: Option<T> //need to constrain the sender to one message type for safety, but compiler needs that to be used _unused: Option<T>, //need to constrain the sender to one message type for safety, but compiler needs that to be used
} }
impl<T: Copy, const LENGTH: usize> MessageQueue<T, LENGTH> { impl<T: Copy, const LENGTH: usize> MessageQueue<T, LENGTH> {
@ -233,7 +239,7 @@ impl<T: Copy, const LENGTH: usize> MessageQueue<T, LENGTH> {
fn get_sender(&self) -> MessageQueueSender<T> { fn get_sender(&self) -> MessageQueueSender<T> {
let instance: MessageQueueSender<T> = MessageQueueSender::<T> { let instance: MessageQueueSender<T> = MessageQueueSender::<T> {
queue_id: Some(self.queue_id), queue_id: Some(self.queue_id),
_unused: None _unused: None,
}; };
instance instance
} }
@ -258,7 +264,7 @@ impl<T> MessageQueueSender<T> {
fn new() -> Self { fn new() -> Self {
Self { Self {
queue_id: None, queue_id: None,
_unused: None _unused: None,
} }
} }
@ -305,7 +311,6 @@ impl Write for Outbytes {
} }
} }
fn mission() { fn mission() {
sifln!("Mission enter"); sifln!("Mission enter");
@ -323,7 +328,13 @@ fn mission() {
let mut _t1: PeriodicTask<'_, 512> = PeriodicTask::new(&mut h1); 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::<PeriodicTaskRunner>(),
&_t1.stack as *const _
);
//let _t2: PeriodicTask<'_, 512> = PeriodicTask::new(&mut h2); //let _t2: PeriodicTask<'_, 512> = PeriodicTask::new(&mut h2);