FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [December 2005 Threads] Error using Heap2Posted by emerico on December 11, 2005 Hello, On a FreeRTOS port on ADuC7026 in nonpreemtive mode using Heap_2 as Heap, I can not correctly start a task after have allocated memory to a pointer.
Example: If a write this: /**********************************************/ 3. xTaskCreate( vAbcsp_aduc_ABCSPLaunch, "ABCSP", 4. 100, NULL, ABCSP_PRIORITY, &xABCSPHANDLE); /**********************************************/
then a will not have any problem. but if l first allocate memory to a pointer like this:
/***********************************************/ 1. uint8* pointer = pvPortMalloc (sizeof(uint8*)); 2. pointer[0] = 0x00; 3. xTaskCreate( vAbcsp_aduc_ABCSPLaunch, "ABCSP", 4. 100, NULL, ABCSP_PRIORITY, &xABCSPHANDLE); /***********************************/
then a have a problem at line 3. (Especially in xTaskCreate where memory is allocated to the Task control block.) Error: /*************** Data Abort: Thumb Instruction at 000830F2H, Memory Access at 00C016E8H ****************************************/
Can somebody help me? any idea where the error is comming from? Best regards Emeric
RE: Error using Heap2Posted by Nobody/Anonymous on December 11, 2005 What are you using to debug your system with? Are you able to step through the code? If so can you find the line that is causing the problem?
The ADuC7026 is not a standard port, did you write it yourself? If so, have you checked the startup code to ensure the processor is in the expected mode, and that the stacks are setup correctly?
RE: Error using Heap2Posted by emerico on December 11, 2005 I am using the Keil debugger.
The error is: in funktion xTaskCreate in tasks.c at line: pxNewTCB = prvAllocateTCBAndStack( usStackDepth );
in funktion prvAllocateTCBAndStack in tasks.c at line: pxNewTCB = ( tskTCB * ) pvPortMalloc( sizeof( tskTCB ) );
in funktion pvPortMalloc in Heap_2.c at line: Especially at line : /* Insert the new block into the list of free blocks. */ prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
Looking in startup.s i found this /************************************
// <h> Stack Configuration (Stack Sizes in Bytes) // <o0> Undefined Mode <0x0-0xFFFFFFFF:4> // <o1> Supervisor Mode <0x0-0xFFFFFFFF:4> // <o2> Abort Mode <0x0-0xFFFFFFFF:4> // <o3> Fast Interrupt Mode <0x0-0xFFFFFFFF:4> // <o4> Interrupt Mode <0x0-0xFFFFFFFF:4> // <o5> User/System Mode <0x0-0xFFFFFFFF:4> // </h> */ UND_Stack_Size EQU 0x00000004 SVC_Stack_Size EQU 0x00000100 ABT_Stack_Size EQU 0x00000004 FIQ_Stack_Size EQU 0x00000004 IRQ_Stack_Size EQU 0x00000080 USR_Stack_Size EQU 0x00000200
AREA STACK, DATA, READWRITE, ALIGN=2 DS (USR_Stack_Size+3)&~3 ; Stack for User/System Mode DS (SVC_Stack_Size+3)&~3 ; Stack for Supervisor Mode DS (IRQ_Stack_Size+3)&~3 ; Stack for Interrupt Mode DS (FIQ_Stack_Size+3)&~3 ; Stack for Fast Interrupt Mode DS (ABT_Stack_Size+3)&~3 ; Stack for Abort Mode DS (UND_Stack_Size+3)&~3 ; Stack for Undefined Mode Top_Stack:
/**********************************
and this.
/*************************************************
// Enter Supervisor Mode and set its Stack Pointer MSR CPSR_c, #Mode_SVC|I_Bit|F_Bit MOV SP, R0 SUB R0, R0, #SVC_Stack_Size
// Enter S Mode and set its Stack Pointer MSR CPSR_c, #Mode_SYS MOV SP, R0
// Start in supervisor mode MSR CPSR_c, #Mode_SVC|I_Bit|F_Bit // Enter the C code LDR R0,=?C?INIT TST R0,#1 ; Bit-0 set: main is Thumb LDREQ LR,=exit?A ; ARM Mode LDRNE LR,=exit?T ; Thumb Mode BX R0 ENDP
/*********************************************/
How to be sure to be sure that the stack is normally setted? thank you in advance.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|