Skip to content

Commit cebab0e

Browse files
committed
Move the delete_task defined to freertos-build
1 parent 1be967a commit cebab0e

File tree

10 files changed

+357
-324
lines changed

10 files changed

+357
-324
lines changed

freertos-cargo-build/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
name = "freertos-build"
77
readme = "README.md"
88
repository = "https://github.com/mcu-rust/FreeRTOS"
9-
version = "0.3.1"
9+
version = "0.4.0"
1010

1111
[lib]
1212

freertos-cargo-build/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ impl Builder {
309309
add_build_files_with_rerun(&mut b, self.freertos_shim_files()); // Shim C file
310310
add_build_file_with_rerun(&mut b, self.heap_c_file()); // Heap C file
311311

312+
setup_all_define(&mut b);
313+
312314
println!("cargo:rerun-if-env-changed={ENV_KEY_FREERTOS_SRC}");
313315
println!("cargo:rerun-if-env-changed={ENV_KEY_FREERTOS_CONFIG}");
314316
println!("cargo:rerun-if-env-changed={ENV_KEY_FREERTOS_SHIM}");
@@ -369,6 +371,18 @@ fn add_include_with_rerun<P: AsRef<Path>>(build: &mut Build, dir: P) {
369371
});
370372
}
371373

374+
fn setup_all_define(cc: &mut cc::Build) {
375+
sync_define(cc, "INCLUDE_vTaskDelete");
376+
sync_define(cc, "INCLUDE_vTaskDelayUntil");
377+
cc.define("INCLUDE_vTaskDelay", "1");
378+
}
379+
380+
fn sync_define(cc: &mut cc::Build, def: &str) {
381+
let v = "DEP_FREERTOS_".to_string() + def;
382+
let v_string = env::var(v).unwrap_or("0".to_string());
383+
cc.define(def, v_string.as_str());
384+
}
385+
372386
#[test]
373387
fn test_paths() {
374388
unsafe { env::set_var("FREERTOS_SRC", "some/path") };

freertos-rust-examples/examples/linux/FreeRTOSConfig.h

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
1 tab == 4 spaces!
5454
*/
5555

56-
5756
#ifndef FREERTOS_CONFIG_H
5857
#define FREERTOS_CONFIG_H
5958

@@ -71,79 +70,80 @@ extern "C" {
7170
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
7271
*----------------------------------------------------------*/
7372

74-
#define configUSE_PREEMPTION 1
75-
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
76-
#define configUSE_IDLE_HOOK 0
77-
#define configUSE_TICK_HOOK 0
78-
#define configTICK_RATE_HZ ( 1000 )
79-
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
80-
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 23 * 1024 ) )
81-
#define configMAX_TASK_NAME_LEN ( 12 )
82-
#define configUSE_TRACE_FACILITY 1
83-
#define configUSE_16_BIT_TICKS 0
84-
#define configIDLE_SHOULD_YIELD 1
85-
#define configUSE_MUTEXES 1
86-
#define configCHECK_FOR_STACK_OVERFLOW 0
87-
#define configUSE_RECURSIVE_MUTEXES 1
88-
#define configQUEUE_REGISTRY_SIZE 20
89-
#define configUSE_MALLOC_FAILED_HOOK 1
90-
#define configUSE_APPLICATION_TASK_TAG 1
91-
#define configUSE_COUNTING_SEMAPHORES 1
92-
#define configUSE_QUEUE_SETS 1
93-
#define configUSE_TASK_NOTIFICATIONS 1
73+
#define configUSE_PREEMPTION 1
74+
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
75+
#define configUSE_IDLE_HOOK 0
76+
#define configUSE_TICK_HOOK 0
77+
#define configTICK_RATE_HZ (1000)
78+
/* In this simulated case, the stack only has to hold one small structure as the real stack
79+
is part of the thread. */
80+
#define configMINIMAL_STACK_SIZE ((unsigned short)50)
81+
#define configTOTAL_HEAP_SIZE ((size_t)(23 * 1024))
82+
#define configMAX_TASK_NAME_LEN (12)
83+
#define configUSE_TRACE_FACILITY 1
84+
#define configUSE_16_BIT_TICKS 0
85+
#define configIDLE_SHOULD_YIELD 1
86+
#define configUSE_MUTEXES 1
87+
#define configCHECK_FOR_STACK_OVERFLOW 0
88+
#define configUSE_RECURSIVE_MUTEXES 1
89+
#define configQUEUE_REGISTRY_SIZE 20
90+
#define configUSE_MALLOC_FAILED_HOOK 1
91+
#define configUSE_APPLICATION_TASK_TAG 1
92+
#define configUSE_COUNTING_SEMAPHORES 1
93+
#define configUSE_QUEUE_SETS 1
94+
#define configUSE_TASK_NOTIFICATIONS 1
9495

9596
/* Software timer related configuration options. */
96-
#define configUSE_TIMERS 1
97-
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
98-
#define configTIMER_QUEUE_LENGTH 20
99-
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
97+
#define configUSE_TIMERS 1
98+
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1)
99+
#define configTIMER_QUEUE_LENGTH 20
100+
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)
100101

101-
#define configMAX_PRIORITIES ( 7 )
102+
#define configMAX_PRIORITIES (7)
102103

103104
/* Run time stats gathering configuration options. */
104-
unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */
105-
#define configGENERATE_RUN_TIME_STATS 1
105+
unsigned long ulGetRunTimeCounterValue(void); /* Prototype of function that returns run time counter. */
106+
#define configGENERATE_RUN_TIME_STATS 1
106107
/* Make use of times(man 2) to gather run-time statistics on the tasks. */
107-
extern void vPortFindTicksPerSecond( void );
108-
extern unsigned long ulPortGetTimerValue( void );
108+
extern void vPortFindTicksPerSecond(void);
109+
extern unsigned long ulPortGetTimerValue(void);
109110

110111
/* Co-routine related configuration options. */
111-
#define configUSE_CO_ROUTINES 1
112-
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
112+
#define configUSE_CO_ROUTINES 1
113+
#define configMAX_CO_ROUTINE_PRIORITIES (2)
113114

114115
/* This demo makes use of one or more example stats formatting functions. These
115116
format the raw data provided by the uxTaskGetSystemState() function in to human
116117
readable ASCII form. See the notes in the implementation of vTaskList() within
117118
FreeRTOS/Source/tasks.c for limitations. */
118-
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
119+
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
119120

120121
/* Set the following definitions to 1 to include the API function, or zero
121122
to exclude the API function. In most cases the linker will remove unused
122123
functions anyway. */
123-
#define INCLUDE_vTaskPrioritySet 1
124-
#define INCLUDE_uxTaskPriorityGet 1
125-
#define INCLUDE_vTaskDelete 1
126-
#define INCLUDE_vTaskCleanUpResources 0
127-
#define INCLUDE_vTaskSuspend 1
128-
#define INCLUDE_vTaskDelayUntil 1
129-
#define INCLUDE_vTaskDelay 1
130-
#define INCLUDE_uxTaskGetStackHighWaterMark 1
131-
#define INCLUDE_xTaskGetSchedulerState 1
132-
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
133-
#define INCLUDE_xTaskGetIdleTaskHandle 1
134-
#define INCLUDE_pcTaskGetTaskName 1
135-
#define INCLUDE_eTaskGetState 1
136-
#define INCLUDE_xSemaphoreGetMutexHolder 1
137-
#define INCLUDE_xTimerPendFunctionCall 1
124+
#define INCLUDE_vTaskPrioritySet 1
125+
#define INCLUDE_uxTaskPriorityGet 1
126+
#define INCLUDE_vTaskCleanUpResources 0
127+
#define INCLUDE_vTaskSuspend 1
128+
#define INCLUDE_uxTaskGetStackHighWaterMark 1
129+
#define INCLUDE_xTaskGetSchedulerState 1
130+
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
131+
#define INCLUDE_xTaskGetIdleTaskHandle 1
132+
#define INCLUDE_pcTaskGetTaskName 1
133+
#define INCLUDE_eTaskGetState 1
134+
#define INCLUDE_xSemaphoreGetMutexHolder 1
135+
#define INCLUDE_xTimerPendFunctionCall 1
138136

139137
/* It is a good idea to define configASSERT() while developing. configASSERT()
140138
uses the same semantics as the standard C assert() macro. */
141-
extern void vAssertCalled( const char * const pcFileName, unsigned long ulLine );
142-
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
139+
extern void vAssertCalled(const char *const pcFileName, unsigned long ulLine);
140+
#define configASSERT(x) \
141+
if ((x) == 0) \
142+
vAssertCalled(__FILE__, __LINE__)
143143

144144
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
145145
#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()
146-
#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()
146+
#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()
147147
/*#include "trcKernelPort.h" */
148148

149149
long xPortIsInsideInterrupt();
@@ -152,5 +152,4 @@ long xPortIsInsideInterrupt();
152152
}
153153
#endif
154154

155-
156155
#endif /* FREERTOS_CONFIG_H */

0 commit comments

Comments
 (0)