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.

TMS320F28388D: Question about 28388D memory allocation

Part Number: TMS320F28388D

Hello teacher, I have been using 28388D to do algorithmic computation recently, CPU1 is used to receive data and send the data to CPU2 through IPC, CPU2 carries out real-time algorithmic updating iteration, but the following problem occurs when I am using it, the variable start_flag that I have set up can't be assigned with a value, may I know what is the reason for this situation, looking forward to hearing from you!

// Read the command
//
IPC_readCommand(IPC_CPU2_L_CPU1_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
&command, &addr, &data);

if(command == IPC_CMD_READ_MEM)
{
status = true;

//
// Read and compare data
//
for(i=0; i<data; i++)
{
recbuf[i]=*((uint32_t *)addr + i);
GPIO_writePin(DEVICE_GPIO_PIN_IPC, 0);
if(recbuf[i] == 0x23)
{
start_flag = 1;
}
if(start_flag)
{
if(recbuf[i] == 0)
{
continue;
}
if(recbuf[i] == 0x2C)
{
start_cnt++;
}
if(recbuf[i] == 0x0A && start_cnt >= 18)
{
CPU2_flag=1;
start_cnt=0;
start_flag=0;
break;
}
}
}
GPIO_writePin(DEVICE_GPIO_PIN_IPC, 0);
}

Is it a memory allocation problem?

Thank you very much!

  • Hi,

    Can you show the declaration of start_flag? Are you able to change the value of start_flag with CPU1?

    Best Regards,

    Ben Collier

  • start_flag is only a char type variable, it can be assigned in CPU1, besides, CPU1 and CPU2 have a part of common RAM, RAMGS0~RAMGS15, but I changed the start position and size of this part in the CMD file in CPU2, but the CMD file in CPU1 is still the default one, does it have anything to do with this? As shown below

  • Zhou,

    I am not sure if changing your RAM sizes will cause a problem, but I will look into that. Can you check where the start_flag char is stored? You can also use this line to store a variable in a specific location: 

    Best Regards,

    Ben Collier

  • Hi, I shouldn't have any problem setting start_flag here, my program sets up a large array of global variables, which takes up a huge amount of my on-chip RAM, as follows

    When I add the above line of code in the program, start_flag can not be assigned properly, I checked the memory address between the two, and there is no conflict, the same way, I commented out this line of code, the program can be restored to normal, as if my program has reached the limit of the memory call stage!

    And here I still have a lot of memory left over? What do you think are the possible reasons for this?

    Thank you very much.

  • Referring this to our compiler team.

  • For the source file that contains this code ...

    if(recbuf[i] == 0x23)
    {
    start_flag = 1;
    }
    if(start_flag)
    {
    if(recbuf[i] == 0)
    {
    continue;
    }

    ... please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • For this source code ...

    if(recbuf[i] == 0x23)
    {
    start_flag = 1;
    }
    if(start_flag)
    {
    if(recbuf[i] == 0)
    {
    continue;
    }
    if(recbuf[i] == 0x2C)
    {
    start_cnt++;
    }
    if(recbuf[i] == 0x0A && start_cnt >= 18)
    {
    CPU2_flag=1;
    start_cnt=0;
    start_flag=0;
    break;
    }

    ... I want to compile it down to assembly code, then inspect it for possible problems.  Unfortunately, I cannot do that with the code you submitted, because these lines are not present.

    I also need all the build options, exactly as the compiler sees them.  And the version of the compiler.

    All of these details are in the article How to Submit a Compiler Test Case.  Please submit all of these details, as described in the article.

    Thanks and regards,

    -George

  • Hi, I generated the corresponding .pp file according to the instructions in How to Submit a Compiler Test Case, but the file can't be uploaded, I've modified the file suffix .txt, you just need to change it back!
    Thank you very much!

  • Unfortunately, I don't see an attachment in your last post.  For details on attaching a file, please see this FAQ.

    Thanks and regards,

    -George

  • My problem was solved, RAMGS0~RAMGS15 are shared memory between CPU1 and CPU2, but that section is allocated to CPU1 by default, I used MemCfg_setGSRAMControllerSel(MEMCFG_SECT_GSx, MEMCFG_GSRAMCONTROLLER_ CPU2) function to allocate the memory in that section to CPU2 and the problem was solved.
    Thank you very much!