statically placed memory in a struct does not seem to work [message #1419412] |
Mon, 08 September 2014 15:24  |
James Lockwood Messages: 43 Registered: July 2009 |
Member |
|
|
I have a module that I wrote that originally worked, and all I did was organize the Instance_State struct to contain another structure that was defined as tcb_t and named tcb.
Here is the relevant pieces of the .xdc file.
struct TCB_t {
volatile StackType_t *pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */
// xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
OSList.ListItem_t xGenericListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
OSList.ListItem_t xEventListItem; /*< Used to reference a task from an event list. */
UInt uxPriority; /*< The priority of the task. 0 is the lowest priority. */
StackType_t pxStack[]; /*< Points to the start of the stack. */
String pcTaskName;/*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
StackType_t *pxEndOfStack; /*< Points to the end of the stack on architectures where the stack grows up from low memory. */
UInt uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
UInt uxTCBNumber; /*< Stores a number that increments each time a TCB is created. It allows debuggers to determine when a task has been deleted and then recreated. */
UInt uxTaskNumberTrace; /*< Stores a number specifically for use by third party trace code. */
UInt uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */
UInt uxMutexesHeld;
// TaskHookFunction_t pxTaskTag;
UInt32 ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
// #if ( configUSE_NEWLIB_REENTRANT == 1 )
/* Allocate a Newlib reent structure that is specific to this task.
Note Newlib support has been included by popular demand, but is not
used by the FreeRTOS maintainers themselves. FreeRTOS is not
responsible for resulting newlib operation. User must be familiar with
newlib and must provide system-wide implementations of the necessary
stubs. Be warned that (at the time of writing) the current newlib design
implements a system-wide malloc() that must be provided with locks. */
// struct _reent xNewLib_reent;
// #endif
};
and in the internal: section
struct Instance_State {
TCB_t tcb;
};
Upon compiling, now the generated code seems to not generate properly (I get compilation errors).
Here is a snippet of the configuration .c file that was generated that gives me the compiler error.
/* --> freeRTOS_mine_OSTask_Instance_State_0_tcb_pxStack__A */
__T1_freeRTOS_mine_OSTask_Instance_State__pxStack freeRTOS_mine_OSTask_Instance_State_0_tcb_pxStack__A[300];
__T1_freeRTOS_mine_OSTask_Instance_State__pxStack is undefined, so says the compiler.
It seems that the type for this array should have been:
__T1_freeRTOS_mine_OSTask_TCB_t__pxStack
The OSTask.h file that was created from my .xdc specification file generates this type for the tcb_t structure (contained within my Instance_State).
/* TCB_t */
typedef freeRTOS_mine_OSTask_StackType_t __T1_freeRTOS_mine_OSTask_TCB_t__pxStack;
typedef freeRTOS_mine_OSTask_StackType_t *__ARRAY1_freeRTOS_mine_OSTask_TCB_t__pxStack;
typedef __ARRAY1_freeRTOS_mine_OSTask_TCB_t__pxStack __TA_freeRTOS_mine_OSTask_TCB_t__pxStack;
struct freeRTOS_mine_OSTask_TCB_t {
volatile freeRTOS_mine_OSTask_StackType_t *pxTopOfStack;
freeRTOS_mine_OSList_ListItem_t xGenericListItem;
freeRTOS_mine_OSList_ListItem_t xEventListItem;
xdc_UInt uxPriority;
__TA_freeRTOS_mine_OSTask_TCB_t__pxStack pxStack;
xdc_String pcTaskName;
freeRTOS_mine_OSTask_StackType_t *pxEndOfStack;
xdc_UInt uxCriticalNesting;
xdc_UInt uxTCBNumber;
xdc_UInt uxTaskNumberTrace;
xdc_UInt uxBasePriority;
xdc_UInt uxMutexesHeld;
xdc_UInt32 ulRunTimeCounter;
};
I have tried several versions of XDCTools, all the way up to 3.30.04.52.
[Updated on: Mon, 08 September 2014 15:26] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02532 seconds