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.

omap4430_A9_Packed_Unpacked_Issue !!!!!!!!!

I am trying to run a program on OMAP4430 on ARM cortexA9 core (using CCSv5.1.0 on Windows platform) which consists of 4 byte(32bit) loads and stores. While running on the board its  giving problem as "No source available". For example,i want to do 4byte load.

unsigned short *ptr; //Let us say ptr is 0x80000000

unsigned int val;

val = *((unsigned int *)ptr); // this is giving above problem.

---------------------------------------------------------------------------------

But if i try to load 1 byte there is absolutely no problem.i.e

unsigned short *ptr; //Let us say ptr is 0x80000000

unsigned short val;

val = *(ptr); // this is giving no problem.

--------------------------------------------------------------------------

whether ARM cortex-9 doesn't support 4 byte load/store or does it need any compiler settings or is it an alignment issue....?????

-Studinstru

  • unsigned short *ptr; //Let us say ptr is 0x80000000

    >>>>>>>>>> You can not just "lets say" that it is some address. You must allocate memory for ptr. This is basic C and not specific to OMAP

  • Studinstru;

    You can try next code:

    unsigned short sval = 1234;

    unsigned short *ptr = &sval;

    unsigned int val;

    val = (unsigned int )(*ptr);

    and can you comment how do you compiled it to get the error? and what tools do you used?

    where is intended to be used? kernel? AFS? are you trying to remove a warning?

    if you assign a valid address to your code it is not returning an error.

    it is not a direct 4 bytes pointer value read assignment, "short" type is defined as 2 bytes and "int" is 4 bytes long, compiler usually takes care for the conversion but in some cases this assignment is not possible if you use a specific cast or incorrect cast.

    I agree with Mayank it is a  C language thing, maybe the compiler for that version is not recognizing it correctly or is not supporting this casting, try to move to latest compiler.

  • You are using CCSv5 that means I am not using the same compiler, I forgot about it.

    Used compiler could have some restriction about casting and type conversion between types.

    I remember to read about it time ago, I could need to check if it was in CCSv5 compilers, I just looked for it in documentation for CodeSourcery but it was not there.

  • @ ALL above,

    The thing is that i want to use _mem4() intrinsic or related unoptimized c code  (*(unsigned int *)(ptr)) for omap4430 Arm 9 processor.

    (may be i can't use _mem4 for arm , but i can use (*(unsigned int *)(ptr)) in my code to unalligned load and store operation).


    #define _mem4(ptr)  (*(unsigned int *)(ptr))

    Its use is to store/load 32 bit data .

    As i mentioned before that am using the address (0x4 series) according to omap TRM only not according to my mind.

    So the ptr is having the the value as 0x4 series address (which is according to TRM and can be usable )

    As i mentioned some part of code in  my previous post :

    ,i want to do 4byte load.

    unsigned short *ptr; //Let us say ptr is 0x4 series address according to TRM

    unsigned int val;

    val = *((unsigned int *)ptr); // this is giving problem

    or

    val = _mem4(ptr);

    None of the above statement is executing..If I try to execute ,it will show " no source code avaliable ".

    I am using the CCS v5.1.0 .I saw one option in CCS v5.1.0 proporties related to unalligned access.

    I used this one too  but still i am facing the same problem.

    Please tell the solution on this.

    This is not trelated with normal /basic pointer error.

    I think there is some allignment issue ( ARM9 Processor+ ccs V5.1.0 +Windows platform )

    -Studinstru


  • Studinstru,

    I don't have any data about _mem4 function.

    But you can ask in CCS forum

    http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/3131.aspx

    you can find next 2 links and other useful links related to CCS

    by searching for _mem4 in E2ETI's forum next link was found

    http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/112/t/11891.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/99/p/141148/510272.aspx#510272

  • Studinstru,

    Some data just found, it was at 3 click after previous post was posted.

    Mentioned function is part of TI's TMS320C6400, C6400+, C6740, and C6600 C/C++ Compiler.

    But it is in the DSP side not for ARM side. C64CGT is part of CCSv5 look for next file for a reference about this functions.

    c:/Program Files/Texas Instruments/C6000 Code Generation Tools 7.3.1/doc/SPRU187T.pdf

    or look for this file SPRU187T.pdf in c:\CCSv5 iinstallation directory.

  • ya I know that _mem4 i can't use as it is related with DSP processor but i can use (*(unsigned int *)(ptr)) for arm processor...

    STILL IT IS GIVING SAME PROBLEM .

    For two byte packing and unpacking it is not giving any problem but for 4 byte packing and unpacking by using (*(unsigned int *)(ptr)) it is giving error.

    Any solution on this.........?

    Do you know any intrinsic related to packing and unpacking of unaligned byte in arm9 (omap4430 processor) ?

    -Studinstru

  • Studinstru;

    I knew about unaligned structures or variables and how they are handled, but mainly it relay in compiler on how to handle this structures when proper identifier is not used.

    I can think that you refer to __packed qualifier, are you?

    If it is not, then you can try to access first the value contained in the variable and then casting it, like mentioned in previous email, other way could be an incorrect use for casting and the manage of variable types since first pointer is 2 bytes long (unsigned short) and tried to be access by a 4 bytes casted pointer (unsigned int)(variables length depends on used configuration), usually a compiler drops an error about it, if it is not supported or managed by the compiler to protect memory access.

    If I am wrong please provide more information about used procedure or share source code and used project properties to try to reproduce it using CCS.