This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C++ Project

Other Parts Discussed in Thread: SYSBIOS

Hi Sir :

I work on TI AM335x IDK platform, the tools's version are as below.

CCS V6

am335x_sysbios_ind_sdk_1.1.0.8

bios_6_41_04_54

ndk_2_24_01_18

xdctools_3_30_06_67_core

I use enetLwip_sysbios example as my basis project and I can compile successfully and run it on IDK platform.

I can ping 192.168.1.2 successfully and see the web page.

Since we work with third party and the third party's application is written by C++, so I add cpp file to enetLwip_sysbios project.

I can compile successfully, but when I load program and execute, the messages show like below.

[CortxA8] enter taskFxn()
ti.sysbios.knl.Semaphore: line 289: assertion failure: A_badContext: bad calling context. Must be called from a Task.
xdc.runtime.Error.raise: terminating execution

I compare the size of two executable file, the first is about 2 MB, however the fail one is about 14 MB.

I think if it is the memory map issue or the stack issue.

Please give me your suggestion!

Best regards,

Marcus 

  • Hi Marcus,

    The error message is because something is calling Semaphore_pend from a hardware interrupt (Hwi) or software interrupt (Swi) and the specified timeout is non-zero.

    You can set a breakpoint at xdc_runtime_Error_raiseX__E and then look at the back trace to see what piece of code is doing the call.

    Todd

  • Hi Sir :

    I appreciate your reply!

    I just add our third party's code but do not call any sub routine from third party's code.

    And the error occurs when I execute enetLwip_sysbios.out.

    I do not know what you mean "You can set a breakpoint at xdc_runtime_Error_raiseX__E".

    Because I trace the code, I find out that I can see the related definition in file below.

    C:\ti\am335x_sysbios_ind_sdk_1.1.0.8\sdk\examples\enetLwip_sysbios\Debug\configPkg\package\cfg\app_pea8fnv.c

    Please give me your suggestion!

    Best regards,

    Marcus

  • Hi Sir :

    I am very sorry about that I give you wrong information.

    The statements below are not correct, in fact I can not find xdc_runtime_Error_raise under my c:\ti directory.

    Because I trace the code, I find out that I can see the related definition in file below.

    C:\ti\am335x_sysbios_ind_sdk_1.1.0.8\sdk\examples\enetLwip_sysbios\Debug\configPkg\package\cfg\app_pea8fnv.c

    Best regards,

    Marcus
  • Can you set a breakpoint in CCS? If you can, please set it at xdc_runtime_Error_raiseX__E.
  • Hi Sir :

    I appreciate your reply!

    I solve this problem since I modify the BIOS.heapSize and Program.stack in app.cfg manually.

    In fact, I do not know the reason why cause this issue, I just refer CCS setting of my third party's example.

    Could you tell me why?

    And how do I know if this problem is caused by BIOS.heapSize or Program.stack?

    Check .map file or another way ?

    Actually, there are some CCS setting of my third party's example like pictures below.

    I do not know if I should use these settings, could you give some suggestion?

    After solving this issue, I try add SD card driver to my project, I can compile successfully.

    However, after I download out file to the board and execute, I get error messages below.

    [CortxA8] 0c5187d  R8  = 0x0000000f

    R1 = 0xf03fe03a  R9  = 0x00000042

    R2 = 0x00000006  R10 = 0x000004a1

    R3 = 0x00000004  R11 = 0x00000000

    R4 = 0x6000019f  R12 = 0x00000c08

    R5 = 0x00000042  SP(R13) = 0x0000000e

    R6 = 0x800e7508  LR(R14) = 0x818708bc

    R7 = 0x800fc4f0  PC(R15) = 0x0000000e

    PSR = 0x800e7508

    DFSR = 0x00000000  IFSR = 0x00000005

    DFAR = 0x00000000  IFAR = 0x0000000e

    ti.sysbios.family.arm.exc.Exception: line 201: E_prefetchAbort: pc = 0x0000000e, lr = 0x818708bc.

    xdc.runtime.Error.raise: terminating execution

    I have tried to modified BIOS.heapSize and Program.stack, but it does not work.

    Could you give me some suggestion?

    Or how do I know if the stack size exceeds the setting?

    Best regards,

    Marcus

  • Sorry, this thread fell through the cracks. Has this issue been resolved?

    Todd
  • Hi Sir :

    In my board, I need Ethernet、SD card、FAT File system and my third party's application.

    So, I use enetLwip_sysbios example as my base project and add the file I need.

    Should I modify am335x.cmd?

    Should I change the property of the project, for example heap and stack size?

    I will appreciate If you could give me some suggestion how to modify these.

    Best regards,

    Marcus

  • Are you using TI compiler? If you are, you can change the heap size by changing the following in the .cfg file.
    BIOS.heapSize = 20480;

    For changing the System stack change the following in the .cfg file.
    Program.stack = 2048;

    For changing the Task Stack sizes, use the desired value in the Task create parameters (either in the .cfg file or in the runtime API)

    Todd
  • Hi Sir :

    I appreciate your reply!

    I use CCS v6 to compile my project.

    As I know, heap size is related with function Memory_alloc() and sysbios and task may use different heap size, am I right?

    And sysbios and task may use different stack size, am I right?

    Since there are several libraries that are called by my project and there are black box, I do not know how many heap and stack sizes the libraries are used.

    My question is how to determine the heap and stack sizes?

    Using map file or CCS can help me to decide heap and stack sizes ?

    Best regards,

    Marcus

  • For stack size, start big and run the application under every condition. Halt the target and look in ROV for the system stack peak (in Hwi->Module) and the task stack peaks (Task->Detailed).

    Heaps are harder. You really need to know the requirements. You can start big and use HeapTrack to help find the peak.

    Todd