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.

LDI32 PRU instruction



Can someone confirm that the LDI32 assembler instruction is a macro? The compiler README briefly mentions this instruction, but doesn't provide much detail.

In the assembler, the instruction looks like:

LDI32 r0, 0x00010002;

But in the code memory, it looks something like:

LDI R0.w2, 1
LDI R0.w0, 2

Thanks,
David

  • It is a pseudo instruction. It's main purpose is to load the address of a symbol that is not known to be in the lower 16-bits of memory. Using LDI32 will generate the proper relocation entry required to load a full 32-bit address.

  • Can you please tell me where (in what documentation) this is described?  I have the TI PRU Assembly Instruction .odf and haven't been able to find LDI32...    

    Thanks

    John

  • John,

    The LDI instruction moves the value from IM(65535), zero extends it, and stores it into REG1. This
    instruction is one form of MOV (the MOV pseudo op uses LDI when the source data is an immediate
    value).
    Definition:
    LDI REG1, IM(65535)
    Operation:
    REG1 = IM(65535)
    Example:
    ldi r1, 10 // Load 10 into r1
    ldi r1, #10 // Load 10 into r1
    ldi r1, 0b10 + 020/2 // Load 10 into r1

  • There might be a misunderstanding. While there is a probability that some version of PRU assembler recognize LDI32, I do not see its description anywhere. 

    Tried to compile:

  • I have only seen the LDI32 instruction mentioned in the README that comes with the PRU compiler. This instruction mnemonic is recognized by the compiler, not the assembler.

    README said:
    2. LDI instruction
       LDI can only be used to load a 16-bit constant into a register. To load a
       32-bit constant, you must use the LDI32 instruction.

  • Thanks David - but I'm still not 100% clear about this LDI32 instruction.   The following is from the README.txt that came with the PRU_2.0.0B2.  It is under the Assembler section not tje Compiler section.  Is it similar to the .ST32 macro that was  defined in the original PASM headers?

    ===============================================================================
    Assembler

    -------------------------------------------------------------------------------
    Instructions
    -------------------------------------------------------------------------------
    The syntax for instruction mnemonics is very similiar to the existing PASM
    assembler. Exceptions are listed here:

    1. MOV instruction
       MOV is only supported for register to register moves. The LDI instruction
       must be used to load a literal into a register.

    2. LDI instruction
       LDI can only be used to load a 16-bit constant into a register. To load a
       32-bit constant, you must use the LDI32 instruction.

    3. MVI instruction
       MVI is only supported on core revisions 2 and 3. The existing PASM assembler
       supports the instruction in a limited form for v1 using pseudo operations.

    4. ZERO instruction
       ZERO is only supported on v2 and v3 cores. For v1, the user should use
       LDI r0, 0.

    5. LFC, SFC, and SCAN
       These instructions are not supported. If support is needed we can add them.

    6. Operands with a '&' prefix
       The existing PASM assembler accepts operands with or without the &
       symbol: LBBO &r0 or LBBO r0. The assembler in this release requires the
       & for these operands.

  • Please confirm whether you are using the Assembler that comes with the TI Code Generations Tools package (downloaded via CCS App Center) or the PASM utility packaged in the am335x github repository? These are very different utilities with different support for a slightly different (pseudo) op code set. From the photo above it looks like you are using the PASM2 assembler instead of the Compiler's assembler.

  • Hello:   The pasted text is from the CGT tools READNE.txt which came from the PRU Compiler that I downloaded from

    http://software-dl.ti.com/codegen/non-esd/downloads/beta.htm

    Thanks

  • My comment was referring to the picture you posted where your makefile invokes pasm_2_x86 to build the code.

  • Sorry - that wasn't me :)   I'm using the CGT TOOLS PRU C compiler on a linux box with BBB -   Just a suggestion, FYI  you might check out this article and his  github repository.   He's done some good work...

    http://www.embeddedrelated.com/showarticle/603.php

    https://github.com/texane/pru_sdk

  • That was me :)

    Thank you for the clarification. (Initially you specified just "assembly").

    Tried to delete my add but "permission denied" :(