Commit 6f953189 authored by Rafal Babski's avatar Rafal Babski

MSP430 - refactor of templates

parent e80cca8b
Pipeline #1870 passed with stage
in 8 minutes and 56 seconds
......@@ -67,8 +67,9 @@ project @_CAPITALIZE:Name_@ is
"@_LOWER:Name_@/drivers/@_Device_Names_@",
@@END_TABLE@@
"FreeRTOS/Source",
"FreeRTOS/Source/portable/GCC/MSP430FR5969"
);
"FreeRTOS/Source/portable/GCC/MSP430FR5969")
& external_as_list("EXTERNAL_SOURCE_PATH", ":")
& external_as_list("@_UPPER:Name_@_EXTERNAL_SOURCE_PATH", ":");
for Object_Dir use "obj";
for Exec_Dir use "../../binaries";
......@@ -98,15 +99,18 @@ project @_CAPITALIZE:Name_@ is
"-DWORD_SIZE=4",
"-mmcu=msp430fr5969",
"-mlarge",
"-ffunction-sections",
"-mcode-region=either",
"-mdata-region=either",
"-mdata-region=upper",
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wno-unused-parameter",
"-Wl,--gc-sections",
"-g",
"-Os");
"-Os")
& external_as_list("@_UPPER:Name_@_USER_CFLAGS", " ")
& external_as_list("USER_CFLAGS", " ");
when "Debug" =>
for Default_Switches ("C") use
("-I/opt/ti/msp430-gcc/include/",
......@@ -119,14 +123,17 @@ project @_CAPITALIZE:Name_@ is
"-DWORD_SIZE=4",
"-mmcu=msp430fr5969",
"-mlarge",
"-ffunction-sections",
"-mcode-region=either",
"-mdata-region=either",
"-mdata-region=upper",
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wno-unused-parameter",
"-O0",
"-g");
"-g")
& external_as_list("@_UPPER:Name_@_USER_CFLAGS", " ")
& external_as_list("USER_CFLAGS", " ");
end case;
end Compiler;
......@@ -144,7 +151,7 @@ project @_CAPITALIZE:Name_@ is
"-mmcu=msp430fr5969",
"-mlarge",
"-mcode-region=either",
"-mdata-region=either",
"-mdata-region=upper",
"-mrelax",
"-Wall",
"-Wextra",
......@@ -152,7 +159,10 @@ project @_CAPITALIZE:Name_@ is
"-Wno-unused-parameter",
"-Wl,-Map=main.map",
"-Wl,--gc-sections",
"-Tmsp430fr5969.ld");
"-Tmsp430fr5969.ld")
& external_as_list("@_UPPER:Name_@_USER_LDFLAGS", " ")
& external_as_list("USER_LDFLAGS", " ");
end Linker;
package Builder is
......
......@@ -151,8 +151,8 @@ void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskPCBBuffer,
}
@@TABLE@@
__attribute__ ((persistent)) SemaphoreHandle_t @_LOWER:Bound_Functions_@_semaphore = {0};
__attribute__ ((persistent)) StaticSemaphore_t prv_@_LOWER:Bound_Functions_@_mutex_buffer = {0};
__attribute__ ((persistent)) SemaphoreHandle_t @_LOWER:Bound_Functions_@_Semaphore = {0};
__attribute__ ((persistent)) StaticSemaphore_t prv_@_LOWER:Bound_Functions_@_Semaphore_Buffer = {0};
@@END_TABLE@@
@_Threads_@
......@@ -163,14 +163,12 @@ int main(void)
prvSetupHardware();
@@TABLE@@
@_LOWER:Bound_Functions_@_semaphore = xSemaphoreCreateMutexStatic(&prv_@_LOWER:Bound_Functions_@_mutex_buffer);
@_LOWER:Bound_Functions_@_Semaphore = xSemaphoreCreateMutexStatic(&prv_@_LOWER:Bound_Functions_@_Semaphore_Buffer);
init_@_LOWER:Bound_Functions_@();
@@END_TABLE@@
@@-- @_Threads_@
@@TABLE@@
initialize_thread_@_LOWER:Thread_Names_@();
Initialize_Thread_@_LOWER:Thread_Names_@();
@@END_TABLE@@
vTaskStartScheduler();
......
......@@ -19,25 +19,25 @@
@@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI @_Name_@
__attribute__ ((persistent)) QueueHandle_t @_Thread_Name_@_global_queue = NULL;
__attribute__ ((persistent)) StaticQueue_t prv_@_LOWER:Thread_Name_@_static_queue = {0};
__attribute__ ((persistent)) uint8_t prv_@_LOWER:Thread_Name_@_queue_area[@_Queue_Size_@ * sizeof(struct Request)] = {0};
__attribute__ ((persistent)) QueueHandle_t @_Thread_Name_@_Global_Queue = NULL;
__attribute__ ((persistent)) static StaticQueue_t prv_@_LOWER:Thread_Name_@_Static_Queue = {0};
__attribute__ ((persistent)) static uint8_t prv_@_LOWER:Thread_Name_@_Queue_Buffer[@_Queue_Size_@ * sizeof(struct Request)] = {0};
__attribute__ ((persistent)) StaticTask_t prv_@_LOWER:Thread_Name_@_tcb = {0};
__attribute__ ((persistent)) StackType_t prv_@_LOWER:Thread_Name_@_stack[@_Stack_Size_In_Bytes_@ / sizeof(StackType_t)] = {0};
__attribute__ ((persistent)) static StaticTask_t prv_@_LOWER:Thread_Name_@_TCB = {0};
__attribute__ ((persistent)) static StackType_t prv_@_LOWER:Thread_Name_@_Stack[@_Stack_Size_In_Bytes_@ / sizeof(StackType_t)] = {0};
static void initialize_thread_@_LOWER:Thread_Name_@()
static void Initialize_Thread_@_LOWER:Thread_Name_@()
{
@_Thread_Name_@_global_queue = xQueueCreateStatic(@_Queue_Size_@,
@_Thread_Name_@_Global_Queue = xQueueCreateStatic(@_Queue_Size_@,
sizeof(struct Request),
prv_@_LOWER:Thread_Name_@_queue_area,
&prv_@_LOWER:Thread_Name_@_static_queue);
prv_@_LOWER:Thread_Name_@_Queue_Buffer,
&prv_@_LOWER:Thread_Name_@_Static_Queue);
xTaskCreateStatic(prv_@_Thread_Name_@Task,
xTaskCreateStatic(prv_@_Thread_Name_@_Task,
"@_Thread_Name_@",
@_Stack_Size_In_Bytes_@ / sizeof(StackType_t),
NULL,
@_Priority_@,
prv_@_LOWER:Thread_Name_@_stack,
&prv_@_LOWER:Thread_Name_@_tcb);
prv_@_LOWER:Thread_Name_@_Stack,
&prv_@_LOWER:Thread_Name_@_TCB);
}
......@@ -28,38 +28,38 @@
#include "transport.h"
#include "@_LOWER:Partition_Name_@_interface.h"
extern QueueHandle_t @_Thread_Name_@_global_queue;
extern QueueHandle_t @_Thread_Name_@_Global_Queue;
@@IF@@ @_RCM_@ = "CYCLIC_OPERATION"
void prv@_Thread_Name_@TimerCallback(TimerHandle_t timer)
void prv_@_Thread_Name_@_Timer_Callback(TimerHandle_t timer)
{
struct Request request;
request.m_length = 0;
xQueueSend(@_Thread_Name_@_global_queue, &request, 0);
xQueueSend(@_Thread_Name_@_Global_Queue, &request, 0);
}
__attribute__ ((persistent)) StaticTimer_t prv_@_LOWER:Thread_Name_@_timer_buffer = {0};
__attribute__ ((persistent)) TimerHandle_t prv_@_LOWER:Thread_Name_@_timer = {0};
__attribute__ ((persistent)) StaticTimer_t prv_@_LOWER:Thread_Name_@_Timer_Buffer = {0};
__attribute__ ((persistent)) TimerHandle_t prv_@_LOWER:Thread_Name_@_Timer = {0};
@@END_IF@@
void prv_@_Thread_Name_@Task(void* prParameters)
void prv_@_Thread_Name_@_Task(void* prParameters)
{
extern QueueHandle_t @_Thread_Name_@_global_queue;
extern QueueHandle_t @_Thread_Name_@_Global_Queue;
@@IF@@ @_RCM_@ = "CYCLIC_OPERATION"
TickType_t period = pdMS_TO_TICKS(@_Period_@);
prv_@_LOWER:Thread_Name_@_timer = xTimerCreateStatic("@_Thread_Name_@Timer",
prv_@_LOWER:Thread_Name_@_Timer = xTimerCreateStatic("@_Thread_Name_@_Timer",
period,
pdTRUE,
NULL,
&prv@_Thread_Name_@TimerCallback,
&prv_@_LOWER:Thread_Name_@_timer_buffer);
xTimerStart(prv_@_LOWER:Thread_Name_@_timer, portMAX_DELAY);
&prv_@_Thread_Name_@_Timer_Callback,
&prv_@_LOWER:Thread_Name_@_Timer_Buffer);
xTimerStart(prv_@_LOWER:Thread_Name_@_Timer, portMAX_DELAY);
@@END_IF@@
while(1)
{
struct Request request;
BaseType_t result = xQueueReceive(@_Thread_Name_@_global_queue, &request, portMAX_DELAY);
BaseType_t result = xQueueReceive(@_Thread_Name_@_Global_Queue, &request, portMAX_DELAY);
if(result == pdTRUE)
{
call_@_LOWER:Thread_Name_@((const char*)request.m_data, request.m_length);
......
......@@ -21,6 +21,6 @@
#ifndef @_Thread_Name_@_INCLUDED
#define @_Thread_Name_@_INCLUDED
void prv_@_Thread_Name_@Task(void* prParameters);
void prv_@_Thread_Name_@_Task(void* prParameters);
#endif
......@@ -51,7 +51,7 @@ void register_remote_transport_func(RemoteTransportFuncPtr fn)
}
@@TABLE@@
extern QueueHandle_t @_In_Port_Thread_Name_@_global_queue;
extern QueueHandle_t @_In_Port_Thread_Name_@_Global_Queue;
@@END_TABLE@@
void process_incomming_message(struct Message* msg)
......@@ -71,7 +71,7 @@ void process_incomming_message(struct Message* msg)
{
@@TABLE@@
case @_LOWER:In_Port_Thread_Name_@_global_inport_@_LOWER:In_Port_Names_@:
xQueueSend(@_In_Port_Thread_Name_@_global_queue,
xQueueSend(@_In_Port_Thread_Name_@_Global_Queue,
&request,
0);
......@@ -97,8 +97,8 @@ void deliver_to_@_Out_Port_Remote_Function_@_@_Out_Port_Remote_Port_Name_@(struc
@@TABLE@@
void deliver_to_@_Thread_Names_@(struct Request* task)
{
extern QueueHandle_t @_Thread_Names_@_global_queue;
xQueueSend(@_Thread_Names_@_global_queue,
extern QueueHandle_t @_Thread_Names_@_Global_Queue;
xQueueSend(@_Thread_Names_@_Global_Queue,
task,
0);
......
......@@ -28,8 +28,13 @@ void pro_@_Parent_Function_@_@_Name_@
@@END_IF@@
@@END_IF@@
{
extern SemaphoreHandle_t @_LOWER:Parent_Function_@_semaphore;
xSemaphoreTake(@_LOWER:Parent_Function_@_semaphore, portMAX_DELAY);
extern SemaphoreHandle_t @_LOWER:Parent_Function_@_Semaphore;
BaseType_t result;
do
{
result = xSemaphoreTake(@_LOWER:Parent_Function_@_Semaphore, portMAX_DELAY);
} while(result != pdTRUE);
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
@_LOWER:Parent_Function_@_@_Name_@();
......@@ -46,5 +51,5 @@ void pro_@_Parent_Function_@_@_Name_@
@@END_INLINE@@
@@END_IF@@
xSemaphoreGive(@_LOWER:Parent_Function_@_semaphore);
xSemaphoreGive(@_LOWER:Parent_Function_@_Semaphore);
}
......@@ -23,8 +23,14 @@
void call_@_LOWER:Thread_Name_@ (const char* buf, size_t len)
{
@@IF@@ @_Need_Mutex_@
extern SemaphoreHandle_t @_LOWER:Pro_Block_Name_@_semaphore;
xSemaphoreTake(@_LOWER:Pro_Block_Name_@_semaphore, portMAX_DELAY);
extern SemaphoreHandle_t @_LOWER:Pro_Block_Name_@_Semaphore;
BaseType_t result;
do
{
result = xSemaphoreTake(@_LOWER:Pro_Block_Name_@_Semaphore, portMAX_DELAY);
} while(result != pdTRUE);
@@END_IF@@
@@IF@@ @_Param_Names'Length_@ > 0
@_Thread_Name_@ (buf, len);
......@@ -32,6 +38,6 @@ void call_@_LOWER:Thread_Name_@ (const char* buf, size_t len)
@_Thread_Name_@();
@@END_IF@@
@@IF@@ @_Need_Mutex_@
xSemaphoreGive(@_LOWER:Pro_Block_Name_@_semaphore);
xSemaphoreGive(@_LOWER:Pro_Block_Name_@_Semaphore);
@@END_IF@@
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment