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.

Compiler/PRU-SWPKG: PRU linker command file for omapl138

Part Number: PRU-SWPKG
Other Parts Discussed in Thread: OMAPL138, CCSTUDIO, OMAP-L138,

Tool/software: TI C/C++ Compiler

Hi Team,

I am currently using OMAPL138 board with CCstudio version 7. My requirement is to build an application with PRU compiler and load it.

So i installed PRU compiler version 2.1.4. and created a hello world project with pru as compiler.

While building this project I see following warnings.

Linking>
warning #10247-D: creating output section ".text" without a SECTIONS specification
warning #10247-D: creating output section ".cinit" without a SECTIONS specification
warning #10247-D: creating output section ".rodata" without a SECTIONS specification
warning #10247-D: creating output section ".stack" without a SECTIONS specification
warning #10247-D: creating output section ".fardata" without a SECTIONS specification
warning #10247-D: creating output section ".rofardata" without a SECTIONS specification
warning #10247-D: creating output section ".farbss" without a SECTIONS specification
warning #10247-D: creating output section ".sysmem" without a SECTIONS specification
warning #10210-D: creating ".stack" section with default size of 0x100; use the -stack option to change the default size
warning #10210-D: creating ".sysmem" section with default size of 0x100; use the -heap option to change the default size
'Finished building target: PRU_test.out'
' '
'Invoking: PRU Hex Utility'
"C:/ti/ccsv7/tools/compiler/ti-cgt-pru_2.1.4/bin/hexpru" -o "PRU_test.hex" "PRU_test.out"
Translating to Extended Tektronix format...
"PRU_test.out" .text ==> .text
"PRU_test.out" .rofardata ==> .rofardata
"PRU_test.out" .rodata ==> .rodata
"PRU_test.out" .cinit ==> .cinit
warning: section PRU_test.out(.rofardata) was padded by 3 to a size of 260 to
satisfy the specified memory width of 4
'Finished building: PRU_test.hex'
' '

though it created a .out file I am not able to load it and execute it. I see following error.

: a data verification error occurred, file load failed.
PRU_0: File Loader: Verification failed: Values at address 0x0008@Program_Memory do not match Please verify target memory and memory map.

then i enabled linker cmd file in the path C:\ti\ccsv7\tools\compiler\ti-cgt-pru_2.1.4\lib\lnk.cmd. 

But still i see compiler warnings

warning: section PRU_test.out(.fardata) was padded by 1 to a size of 416 to
satisfy the specified memory width of 4
warning: section PRU_test.out(.rofardata) at 020373h overlaps

Not sure which linker command file i need to add to run basic program on PRU.

Please provide your suggestions.

Thanks

Phani

  • I took a linker command file from one of our Linux SDK's that was intended for the PRU of the AM335x, and I have adapted it a bit using the memory map as documented here.

    MEMORY
    {
        PAGE 0:
          PRUIMEM:   o = 0x00000000  l = 0x00001000  /* 4kB PRU0 Instruction RAM */
        PAGE 1:
          PRUDMEM:   o = 0x00000000  l = 0x00000200  /* 512B PRU Data RAM 0 */
    }
    
    SECTIONS
    {
        .text:_c_int00* >  0x0
        .text          >  PRUIMEM, PAGE 0
        .bss           >  PRUDMEM, PAGE 1
        .data          >  PRUDMEM, PAGE 1
        .rodata        >  PRUDMEM, PAGE 1
        .farbss        >  PRUDMEM, PAGE 1
        .fardata       >  PRUDMEM, PAGE 1
        .rofardata     >  PRUDMEM, PAGE 1
        .sysmem        >  PRUDMEM, PAGE 1
        .stack         >  PRUDMEM, PAGE 1
        .init_array    >  PRUDMEM, PAGE 1
        .cinit         >  PRUDMEM, PAGE 1
        .args          >  PRUDMEM, PAGE 1
    }

    I've not specifically tested this out, but I think it should be usable.  The big challenge is that each PRU has only 512 bytes of data RAM!  So you'll need to be very careful with how you allocate things like the stack size, etc.

  • Hi Brad,

    With changes you suggested I kept stack and heap size to 0x10 . But still seeing some warning while compiling and not able to load the binary.

    Translating to Extended Tektronix format...
    "PRU_test.out" .text ==> .text
    "PRU_test.out" .rodata ==> .rodata
    "PRU_test.out" .fardata ==> .fardata
    "PRU_test.out" .rofardata ==> .rofardata
    warning: section PRU_test.out(.fardata) was padded by 1 to a size of 416 to
    satisfy the specified memory width of 4
    warning: section PRU_test.out(.rofardata) at 020373h overlaps
    PRU_test.out(.fardata) (PRU_test.out(.rofardata) incomplete or skipped)
    'Finished building: PRU_test.hex'.

    Also verified map file generated and it looks like origin starts at 0x0008 even though we mentioned it as 0x0000. So while loading the file i am seeing following error

    "PRU_0: File Loader: Verification failed: Values at address 0x0008@Program_Memory do not match Please verify target memory and memory map."

    Is there any other option that specifies the origin address??
    I will paste the map file in next post.

    Please give your suggestions.

    Thanks
    Phani
  • ******************************************************************************
    PRU Linker PC v2.1.4
    ******************************************************************************
    >> Linked Wed Feb 01 12:02:42 2017

    OUTPUT FILE NAME: <PRU_test.out>
    ENTRY POINT SYMBOL: "_c_int00_noargs" address: 00005900


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    PAGE 0:
    P_MEM 00000008 0003fff8 0000595c 0003a69c RWIX

    PAGE 1:
    NEAR_MEM 00000008 0000fff8 00000034 0000ffc4 RWIX
    FAR_MEM 00010000 80000000 00010474 7ffefb8c RWIX


    SECTION ALLOCATION MAP

    output attributes/
    section page origin length input sections
    -------- ---- ---------- ---------- ----------------
    .text 0 00000008 0000595c
    00000008 00000444 rtspruv1_le.lib : frcdivd.obj (.text:__TI_frcdivd)
    0000044c 00000334 : frcmpyd.obj (.text:__TI_frcmpyd)
    00000780 00000320 : _printfi.obj (.text:_setfield)
    00000aa0 000002a0 : _printfi.obj (.text:__TI_printfi)
    00000d40 00000280 : _printfi.obj (.text:_pproc_fgea)
    00000fc0 00000268 : mpyd.obj (.text:__pruabi_mpyd)
    00001228 00000260 : frcaddd.obj (.text:__TI_frcaddd)
    00001488 00000254 : addd.obj (.text:__pruabi_addd)
    000016dc 00000250 : _printfi.obj (.text:acvt)
    0000192c 0000021c : _printfi.obj (.text:_pconv_e)
    00001b48 00000210 : _printfi.obj (.text:ecvt)
    00001d58 00000200 : _printfi.obj (.text:fcvt)
    00001f58 000001ec : divd.obj (.text:__pruabi_divd)
    00002144 000001c8 : _printfi.obj (.text:_getarg_diouxp)
    0000230c 000001c8 : ldexp.obj (.text:ldexp)
    000024d4 000001bc : imath64.obj (.text:__pruabi_divull)
    00002690 000001b0 : fputs.obj (.text:fputs)
    00002840 000001a0 : _printfi.obj (.text:_pconv_g)
    000029e0 00000190 : _printfi.obj (.text:_pproc_diouxp)
    00002b70 0000018c : _printfi.obj (.text:_pconv_a)
    00002cfc 0000018c : _printfi.obj (.text:_pproc_fwp)
    00002e88 00000188 : _printfi.obj (.text:_pproc_str)
    00003010 00000168 : frexp.obj (.text:frexp)
    00003178 00000164 : setvbuf.obj (.text:setvbuf)
    000032dc 00000150 : llmpy.obj (.text:__pruabi_mpyll)
    0000342c 00000140 : memory.obj (.text:malloc)
    0000356c 00000124 : divu_c.obj (.text:__pruabi_divu)
    00003690 00000104 : trgdrv.obj (.text:HOSTrename)
    00003794 000000fc : trgdrv.obj (.text:HOSTlseek)
    00003890 000000fc : _printfi.obj (.text:_mcpy)
    0000398c 000000f0 : trgdrv.obj (.text:HOSTopen)
    00003a7c 000000f0 : _printfi.obj (.text:_ecpy)
    00003b6c 000000ec : fputc.obj (.text:fputc)
    00003c58 000000e8 : _printfi.obj (.text:_ltostr)
    00003d40 000000e0 : memory.obj (.text:free)
    00003e20 000000d8 : lowlev.obj (.text:getdevice)
    00003ef8 000000d4 : lowlev.obj (.text:close)
    00003fcc 000000cc : fclose.obj (.text:__TI_closefile)
    00004098 000000cc : remu_c.obj (.text:__pruabi_remu)
    00004164 000000c8 : fseek.obj (.text:fseek)
    0000422c 000000c0 : trgdrv.obj (.text:HOSTread)
    000042ec 000000c0 : trgdrv.obj (.text:HOSTwrite)
    000043ac 000000bc : led.obj (.text:__pruabi_led)
    00004468 000000b8 : gtd.obj (.text:__pruabi_gtd)
    00004520 000000b8 : memory.obj (.text:minit)
    000045d8 000000b4 : ged.obj (.text:__pruabi_ged)
    0000468c 000000b4 : ltd.obj (.text:__pruabi_ltd)
    00004740 000000ac : autoinit.obj (.text:__TI_auto_init)
    000047ec 000000a4 : _io_perm.obj (.text:__TI_wrt_ok)
    00004890 000000a0 : trgdrv.obj (.text:HOSTclose)
    00004930 000000a0 : fflush.obj (.text:__TI_doflush)
    000049d0 000000a0 : ltoa.obj (.text:ltoa)
    00004a70 0000009c : renormd.obj (.text:__TI_renormd)
    00004b0c 00000098 : trgdrv.obj (.text:HOSTunlink)
    00004ba4 00000098 : _printfi.obj (.text:_pconv_f)
    00004c3c 00000094 : neqld.obj (.text:__pruabi_neqd)
    00004cd0 00000094 : _printfi.obj (.text:_fcpy)
    00004d64 00000090 : eqld.obj (.text:__pruabi_eqd)
    00004df4 00000090 : fltid.obj (.text:__pruabi_fltid)
    00004e84 0000008c : divi_c.obj (.text:__pruabi_divi)
    00004f10 0000008c : fixdi.obj (.text:__pruabi_fixdi)
    00004f9c 00000088 : fopen.obj (.text:__TI_cleanup)
    00005024 00000084 : printf.obj (.text:printf)
    000050a8 0000007c : atoi.obj (.text:atoi)
    00005124 00000078 : _printfi.obj (.text:_div)
    0000519c 00000074 : _printfi.obj (.text:incr_hex)
    00005210 00000070 : isinf.obj (.text:__pruabi_isinf)
    00005280 00000070 : imath64.obj (.text:__pruabi_lslll)
    000052f0 00000070 : _printfi.obj (.text:_pproc_fflags)
    00005360 00000070 : imath64.obj (.text:_subcull)
    000053d0 0000006c : lowlev.obj (.text:lseek)
    0000543c 0000006c : lowlev.obj (.text:write)
    000054a8 00000068 : exit.obj (.text:exit)
    00005510 00000060 : remi_c.obj (.text:__pruabi_remi)
    00005570 00000058 : trgmsg.obj (.text:__TI_writemsg)
    000055c8 00000058 : lowlev.obj (.text:finddevice)
    00005620 00000058 : lowlev.obj (.text:unlink)
    00005678 00000054 : trgmsg.obj (.text:__TI_readmsg)
    000056cc 00000050 : imath64.obj (.text:__pruabi_lsrll)
    0000571c 00000048 : memccpy.obj (.text:memccpy)
    00005764 00000048 : _printfi.obj (.text:val_hex)
    000057ac 00000034 : asri.obj (.text:__pruabi_asri)
    000057e0 00000034 : _printfi.obj (.text:__pruabi_isnan)
    00005814 00000034 : memcpy.obj (.text)
    00005848 0000002c : subd.obj (.text:__pruabi_subd)
    00005874 00000024 : imath64.obj (.text:__lmbdull)
    00005898 00000024 : mpyi.obj (.text:__pruabi_mpyi)
    000058bc 00000024 hello.obj (.text:main)
    000058e0 00000020 rtspruv1_le.lib : negd.obj (.text:__pruabi_negd)
    00005900 0000001c : boot_special.obj (.text:_c_int00_noargs)
    0000591c 0000001c : printf.obj (.text:_outc)
    00005938 00000018 : printf.obj (.text:_outs)
    00005950 00000008 : exit.obj (.text:abort)
    00005958 00000008 : exit.obj (.text:loader_exit)
    00005960 00000004 : _lock.obj (.text:_nop)

    .rodata 1 00000008 00000034
    00000008 00000024 rtspruv1_le.lib : _printfi.obj (.rodata:.string)
    0000002c 00000010 hello.obj (.rodata:.string)

    .stack 1 00010000 00008000 UNINITIALIZED
    00010000 00000004 rtspruv1_le.lib : boot.obj (.stack)
    00010004 00007ffc --HOLE--

    .sysmem 1 00018000 00008000 UNINITIALIZED
    00018000 00000008 rtspruv1_le.lib : memory.obj (.sysmem)
    00018008 00007ff8 --HOLE--

    .farbss 1 00020000 000001d4 UNINITIALIZED
    00020000 00000120 rtspruv1_le.lib : trgmsg.obj (.farbss)
    00020120 000000a0 : defs.obj (.farbss)
    000201c0 0000000c : memory.obj (.farbss)
    000201cc 00000008 : trgdrv.obj (.farbss)

    .fardata 1 000201d4 0000019f
    000201d4 000000f0 rtspruv1_le.lib : defs.obj (.fardata:_ftable)
    000202c4 00000050 : lowlev.obj (.fardata:_stream)
    00020314 0000004b : lowlev.obj (.fardata:_device)
    0002035f 00000004 : defs.obj (.fardata)
    00020363 00000004 : errno.obj (.fardata)
    00020367 00000004 : exit.obj (.fardata)
    0002036b 00000004 : memory.obj (.fardata)
    0002036f 00000002 : _lock.obj (.fardata:_lock)
    00020371 00000002 : _lock.obj (.fardata:_unlock)

    .rofardata
    * 1 00020373 00000101
    00020373 00000101 rtspruv1_le.lib : ctype.obj (.rofardata:.string:_ctypes_)

    .init_array
    * 1 00010000 00000000 UNINITIALIZED

    .cinit 1 00010000 00000000 UNINITIALIZED


    SEGMENT ATTRIBUTES

    id tag seg value
    -- --- --- -----
    0 PHA_PAGE 1 1
    1 PHA_PAGE 2 1
    2 PHA_PAGE 3 1
    3 PHA_PAGE 4 1


    GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name

    page address name
    ---- ------- ----
    0 00005958 C$$EXIT
    0 000055c0 C$$IO$$
    0 00004890 HOSTclose
    0 00003794 HOSTlseek
    0 0000398c HOSTopen
    0 0000422c HOSTread
    0 00003690 HOSTrename
    0 00004b0c HOSTunlink
    0 000042ec HOSTwrite
    1 00020000 __CIOBUF_
    n/a UNDEFED __TI_CINIT_Base
    n/a UNDEFED __TI_CINIT_Limit
    n/a UNDEFED __TI_Handler_Table_Base
    n/a UNDEFED __TI_Handler_Table_Limit
    n/a UNDEFED __TI_INITARRAY_Base
    n/a UNDEFED __TI_INITARRAY_Limit
    1 00018000 __TI_STACK_END
    abs 00008000 __TI_STACK_SIZE
    abs 00008000 __TI_SYSMEM_SIZE
    0 00004740 __TI_auto_init
    0 00004f9c __TI_cleanup
    1 00020367 __TI_cleanup_ptr
    0 00003fcc __TI_closefile
    0 00004930 __TI_doflush
    1 00020369 __TI_dtors_ptr
    0 00001228 __TI_frcaddd
    0 00000008 __TI_frcdivd
    0 0000044c __TI_frcmpyd
    1 0002035f __TI_ft_end
    0 00000aa0 __TI_printfi
    0 00005678 __TI_readmsg
    0 00004a70 __TI_renormd
    1 00020120 __TI_tmpnams
    0 00005570 __TI_writemsg
    0 000047ec __TI_wrt_ok
    abs ffffffff __binit__
    abs ffffffff __c_args__
    0 00001488 __pruabi_addd
    0 000057ac __pruabi_asri
    0 00001f58 __pruabi_divd
    0 00004e84 __pruabi_divi
    0 0000356c __pruabi_divu
    0 000024d4 __pruabi_divull
    0 00004d64 __pruabi_eqd
    0 00004f10 __pruabi_fixdi
    0 00004df4 __pruabi_fltid
    0 000045d8 __pruabi_ged
    0 00004468 __pruabi_gtd
    0 00005210 __pruabi_isinf
    0 000043ac __pruabi_led
    0 00005280 __pruabi_lslll
    0 000056cc __pruabi_lsrll
    0 0000468c __pruabi_ltd
    0 00000fc0 __pruabi_mpyd
    0 00005898 __pruabi_mpyi
    0 000032dc __pruabi_mpyll
    0 000058e0 __pruabi_negd
    0 00004c3c __pruabi_neqd
    0 00005510 __pruabi_remi
    0 00004098 __pruabi_remu
    0 00005848 __pruabi_subd
    0 00005900 _c_int00_noargs
    1 00020373 _ctypes_
    1 000201d4 _ftable
    1 0002036f _lock
    0 00005960 _nop
    1 00010000 _stack
    1 00018000 _sys_memory
    1 00020371 _unlock
    0 00005950 abort
    0 000050a8 atoi
    abs ffffffff binit
    0 00003ef8 close
    1 00020363 errno
    0 000054a8 exit
    0 00003b6c fputc
    0 00002690 fputs
    0 00003d40 free
    0 00003010 frexp
    0 00004164 fseek
    0 0000230c ldexp
    0 000053d0 lseek
    0 000049d0 ltoa
    0 000058bc main
    0 0000342c malloc
    0 0000571c memccpy
    0 00005814 memcpy
    0 00004520 minit
    0 00005024 printf
    0 00003b6c putc
    0 00005620 remove
    0 00003178 setvbuf
    0 00005620 unlink
    0 0000543c write


    GLOBAL SYMBOLS: SORTED BY Symbol Address

    page address name
    ---- ------- ----
    0 00000008 __TI_frcdivd
    0 0000044c __TI_frcmpyd
    0 00000aa0 __TI_printfi
    0 00000fc0 __pruabi_mpyd
    0 00001228 __TI_frcaddd
    0 00001488 __pruabi_addd
    0 00001f58 __pruabi_divd
    0 0000230c ldexp
    0 000024d4 __pruabi_divull
    0 00002690 fputs
    0 00003010 frexp
    0 00003178 setvbuf
    0 000032dc __pruabi_mpyll
    0 0000342c malloc
    0 0000356c __pruabi_divu
    0 00003690 HOSTrename
    0 00003794 HOSTlseek
    0 0000398c HOSTopen
    0 00003b6c fputc
    0 00003b6c putc
    0 00003d40 free
    0 00003ef8 close
    0 00003fcc __TI_closefile
    0 00004098 __pruabi_remu
    0 00004164 fseek
    0 0000422c HOSTread
    0 000042ec HOSTwrite
    0 000043ac __pruabi_led
    0 00004468 __pruabi_gtd
    0 00004520 minit
    0 000045d8 __pruabi_ged
    0 0000468c __pruabi_ltd
    0 00004740 __TI_auto_init
    0 000047ec __TI_wrt_ok
    0 00004890 HOSTclose
    0 00004930 __TI_doflush
    0 000049d0 ltoa
    0 00004a70 __TI_renormd
    0 00004b0c HOSTunlink
    0 00004c3c __pruabi_neqd
    0 00004d64 __pruabi_eqd
    0 00004df4 __pruabi_fltid
    0 00004e84 __pruabi_divi
    0 00004f10 __pruabi_fixdi
    0 00004f9c __TI_cleanup
    0 00005024 printf
    0 000050a8 atoi
    0 00005210 __pruabi_isinf
    0 00005280 __pruabi_lslll
    0 000053d0 lseek
    0 0000543c write
    0 000054a8 exit
    0 00005510 __pruabi_remi
    0 00005570 __TI_writemsg
    0 000055c0 C$$IO$$
    0 00005620 remove
    0 00005620 unlink
    0 00005678 __TI_readmsg
    0 000056cc __pruabi_lsrll
    0 0000571c memccpy
    0 000057ac __pruabi_asri
    0 00005814 memcpy
    0 00005848 __pruabi_subd
    0 00005898 __pruabi_mpyi
    0 000058bc main
    0 000058e0 __pruabi_negd
    0 00005900 _c_int00_noargs
    0 00005950 abort
    0 00005958 C$$EXIT
    0 00005960 _nop
    1 00010000 _stack
    1 00018000 __TI_STACK_END
    1 00018000 _sys_memory
    1 00020000 __CIOBUF_
    1 00020120 __TI_tmpnams
    1 000201d4 _ftable
    1 0002035f __TI_ft_end
    1 00020363 errno
    1 00020367 __TI_cleanup_ptr
    1 00020369 __TI_dtors_ptr
    1 0002036f _lock
    1 00020371 _unlock
    1 00020373 _ctypes_
    abs 00008000 __TI_STACK_SIZE
    abs 00008000 __TI_SYSMEM_SIZE
    abs ffffffff __binit__
    abs ffffffff __c_args__
    abs ffffffff binit
    n/a UNDEFED __TI_CINIT_Base
    n/a UNDEFED __TI_CINIT_Limit
    n/a UNDEFED __TI_Handler_Table_Base
    n/a UNDEFED __TI_Handler_Table_Limit
    n/a UNDEFED __TI_INITARRAY_Base
    n/a UNDEFED __TI_INITARRAY_Limit

    [94 symbols]
  • The exact section name is _c_int00_noargs and so that isn't getting picked up since we specified _c_int00 to go at address 0. In the linker command file, please change this:

    .text:_c_int00 > 0x0

    to this:

    .text:_c_int00* > 0x0
  • phani kiran said:
    Translating to Extended Tektronix format...
    "PRU_test.out" .text ==> .text
    "PRU_test.out" .rodata ==> .rodata
    "PRU_test.out" .fardata ==> .fardata
    "PRU_test.out" .rofardata ==> .rofardata
    warning: section PRU_test.out(.fardata) was padded by 1 to a size of 416 to
    satisfy the specified memory width of 4
    warning: section PRU_test.out(.rofardata) at 020373h overlaps
    PRU_test.out(.fardata) (PRU_test.out(.rofardata) incomplete or skipped)
    'Finished building: PRU_test.hex'.

    If a section is being skipped entirely, that will likely be a problem at some point.  It sounds like there are certain alignment constraints imposed on the hex file.  In order to make the out file compliant, you might want to add some align directives.  For example, change this:

        .fardata       >  PRUDMEM, PAGE 1
        .rofardata     >  PRUDMEM, PAGE 1

    to this:

        .fardata       >  PRUDMEM align=4, PAGE 1
        .rofardata     >  PRUDMEM align=4, PAGE 1

    I think that will get rid of your immediate error, though you may see errors pop up for other sections in the future.  Try this out first to ensure it really does address that issue.  If so, then perhaps you might consider adding it to all the sections.

  • Hi Brad,

    I realized that old linker file is copied and was still using it.
    I removed it and copied new file, but currently am seeing compilation error.
    I tried to increase stack and heap size but still error exists.

    following is the link file:
    -cr /* LINK USING C CONVENTIONS */
    -stack 0x100 /* SOFTWARE STACK SIZE */
    -heap 0x100 /* HEAP AREA SIZE */
    /*--args 0x100 */

    /* SPECIFY THE SYSTEM MEMORY MAP */

    MEMORY
    {
    PAGE 0:
    PRUIMEM: org = 0x00000000 len = 0x00001000 /* 4kB PRU0 Instruction RAM */

    PAGE 1:
    PRUDMEM: org = 0x00000000 len = 0x00000200 /* 512B PRU Data RAM 0 */

    }

    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

    SECTIONS
    {
    .text:_c_int00* > 0x0
    .text > PRUIMEM, PAGE 0
    .bss > PRUDMEM, PAGE 1
    .data > PRUDMEM, PAGE 1
    .rodata > PRUDMEM, PAGE 1

    .farbss > PRUDMEM, PAGE 1
    .fardata > PRUDMEM, PAGE 1
    .rofardata > PRUDMEM, PAGE 1

    .sysmem > PRUDMEM, PAGE 1
    .stack > PRUDMEM, PAGE 1
    .init_array > PRUDMEM, PAGE 1
    .cinit > PRUDMEM, PAGE 1

    .args > PRUDMEM, PAGE 1

    }



    and error am seeing is...

    ../lnk.cmd" -llibc.a
    <Linking>
    "../lnk.cmd", line 41: error #10099-D: program will not fit into available memory. placement with alignment fails for section ".text" size 0x5940 page 0. Available memory ranges:
    PRUIMEM size: 0x1000 unused: 0xfe4 max hole: 0xfe4
    "../lnk.cmd", line 47: error #10099-D: program will not fit into available memory. placement with alignment fails for section ".fardata" size 0x19f page 1. Available memory ranges:

    PRUDMEM size: 0x200 unused: 0x2c max hole: 0x2c
    >> Compilation failure
    makefile:141: recipe for target 'PRU_test.out' failed
    "../lnk.cmd", line 48: error #10099-D: program will not fit into available memory. placement with alignment fails for section ".rofardata" size 0x101 page 1. Available memory ranges:
    PRUDMEM size: 0x200 unused: 0x2c max hole: 0x2c
    "../lnk.cmd", line 51: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".stack" size 0x100 page 1. Available memory ranges:
    PRUDMEM size: 0x200 unused: 0x2c max hole: 0x2c
    "../lnk.cmd", line 50: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".sysmem" size 0x100 page 1. Available memory ranges:
    PRUDMEM size: 0x200 unused: 0x2c max hole: 0x2c
    "../lnk.cmd", line 44: error #10099-D: program will not fit into available memory. placement with alignment fails for section ".rodata" size 0x34 page 1. Available memory ranges:
    PRUDMEM size: 0x200 unused: 0x2c max hole: 0x2c
    error #10010: errors encountered during linking; "PRU_test.out" not built
    gmake[1]: *** [PRU_test.out] Error 1
    gmake[1]: Target 'secondary-outputs' not remade because of errors.
    gmake: *** [all] Error 2
    makefile:137: recipe for target 'all' failed

    **** Build Finished ****


    Please suggest the values...

    Thanks
    Phani
  • phani kiran said:
    <Linking>
    "../lnk.cmd", line 41: error #10099-D: program will not fit into available memory. placement with alignment fails for section ".text" size 0x5940 page 0. Available memory ranges:

    You created a program that needs 0x5940 bytes of memory, but there's only 0x1000 physically available.  You said at the very beginning that you're making a "hello world".  If you are literally doing printf("Hello world!\n") that is not going to work.  The printf libraries are HUGE and not suitable at all to the PRU.  You should start with an empty program.  Maybe something like:

    void main() {

    volatile int i=0;

    i++;

    }

    See if you can get that to build, load, and that you can step through it and see the variable increment.

  • Hi Brad,
    I am able to build it with out any warnings. But currently working out of office and doesnt have access to hardware.
    I will load it and verify.

    Thanks
    Phani
  • Hi Brad,

    I am still seeing error while loading.

    PRU_0: File Loader: Verification failed: Values at address 0x0000@Program_Memory do not match Please verify target memory and memory map.
    PRU_0: GEL: File: C:\Users\h124328\Desktop\binaries_web\IM5R2\PRU_test\Debug\PRU_test.out: a data verification error occurred, file load failed.


    Current map file looks like this.

    ******************************************************************************
    PRU Linker PC v2.1.4
    ******************************************************************************
    >> Linked Thu Feb 02 14:02:16 2017

    OUTPUT FILE NAME: <PRU_test.out>
    ENTRY POINT SYMBOL: "_c_int00_noinit_noargs_noexit" address: 00000000


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    PAGE 0:
    PRUIMEM 00000000 00001000 0000004c 00000fb4 RWIX

    PAGE 1:
    PRUDMEM 00000000 00000200 00000010 000001f0 RWIX


    SECTION ALLOCATION MAP

    output attributes/
    section page origin length input sections
    -------- ---- ---------- ---------- ----------------
    .text:_c_int00*
    * 0 00000000 00000014
    00000000 00000014 rtspruv1_le.lib : boot_special.obj (.text:_c_int00_noinit_noargs_noexit)

    .text 0 00000014 00000038
    00000014 00000028 hello.obj (.text:main)
    0000003c 00000008 rtspruv1_le.lib : exit.obj (.text:abort)
    00000044 00000008 : exit.obj (.text:loader_exit)

    .stack 1 00000000 00000010 UNINITIALIZED
    00000000 00000004 rtspruv1_le.lib : boot.obj (.stack)
    00000004 0000000c --HOLE--

    .init_array
    * 1 00000000 00000000 UNINITIALIZED

    .cinit 1 00000000 00000000 UNINITIALIZED


    SEGMENT ATTRIBUTES

    id tag seg value
    -- --- --- -----
    0 PHA_PAGE 1 1


    GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name

    page address name
    ---- ------- ----
    0 00000044 C$$EXIT
    1 00000010 __TI_STACK_END
    abs 00000010 __TI_STACK_SIZE
    abs ffffffff __binit__
    abs ffffffff __c_args__
    0 00000000 _c_int00_noinit_noargs_noexit
    1 00000000 _stack
    0 0000003c abort
    abs ffffffff binit
    0 00000014 main


    GLOBAL SYMBOLS: SORTED BY Symbol Address

    page address name
    ---- ------- ----
    0 00000000 _c_int00_noinit_noargs_noexit
    0 00000014 main
    0 0000003c abort
    0 00000044 C$$EXIT
    1 00000000 _stack
    1 00000010 __TI_STACK_END
    abs 00000010 __TI_STACK_SIZE
    abs ffffffff __binit__
    abs ffffffff __c_args__
    abs ffffffff binit

    [10 symbols]

    Please suggest any pointer on proceding further.

    thanks
    Phani
  • phani kiran said:
    I am still seeing error while loading.

    PRU_0: File Loader: Verification failed: Values at address 0x0000@Program_Memory do not match Please verify target memory and memory map.
    PRU_0: GEL: File: C:\Users\h124328\Desktop\binaries_web\IM5R2\PRU_test\Debug\PRU_test.out: a data verification error occurred, file load failed.

    While connected to the PRU can you open a memory window (or a disassembly window perhaps for the instruction memory) to look at those addresses?  What do you see? If you poke a value does it stick?

  • Hi Brad,

    Memory window and disassembly for PRU Device memory shows all zeros. And when trying to place some value it is not getting updated and value returns to 0's.

    Thanks
    Phani
  • Since the PRU is a co-processor it is disabled by default. There is some housekeeping that needs to be done in order to get it into a state where the RAM is writeable.

    Please install the PRU-SWPKG for OMAP-L138. Although these examples use the older PASM tools, there is still some useful information contained inside. In particular, please have a look at the file host/common/src/pru.c. There are several important functions inside there. In particular, you should look at PRU_enable and PRU_run. These are all "helper" functions that would be executed by the ARM9 in the process of loading/running a program on the PRU. The PRU_enable function does the "pre work" with respect to enabling clocks, etc. You would need to enable the PRU through the PSC prior to attempting to load the code. Similarly you would need to perform operations along the lines of the PRU_run function to get the PRU into an operational state.

  • Hi Brad,

    I tried to include pru.c file along with other headers and able to build project.
    In the application code I added PRU_enable at the entry of function. And PRU_disable at end.
    But still while loading I am seeing same error.
    Do I have to change any other settings?

    Thanks
    Phani
  • You cannot simply include more code into the PRU executable.  The problem is that the PRU executable is never actually making it to memory.

    I've made a few modifications to the gel file located at ccsv7\ccs_base\emulation\boards\lcdkomapl138\gel\OMAP-L138_LCDK.gel.  Here is the updated file:

    OMAP-L138_LCDK.gel

    And in case you're curious what I did, here are the changes I made:

    diff --git a/OMAP-L138_LCDK.gel b/OMAP-L138_LCDK.gel
    index 850ad1d..bcf97c3 100755
    --- a/OMAP-L138_LCDK.gel
    +++ b/OMAP-L138_LCDK.gel
    @@ -99,7 +99,7 @@
     #define LPSC_SCR0        10
     #define LPSC_SCR1        11
     #define LPSC_SCR2        12
    -// LPSC #13 not used
    +#define LPSC_PRU         13  /*PSC0*/
     #define LPSC_ARM         14  /*PSC0*/
     #define LPSC_DSP         15  /*PSC0*/
    
    @@ -234,6 +234,16 @@
     #define PLL_STABILIZATION_TIME   2000
     #define PLL_RESET_TIME_CNT       200
    
    +/* PRU Related Registers */
    +#define PRU0_BASE           0x01C37000
    +#define PRU0_CONTROL        *(unsigned int*)(PRU0_BASE + 0x0)
    +#define PRU0_STATUS         *(unsigned int*)(PRU0_BASE + 0x4)
    +
    +#define PRU1_BASE           0x01C37800
    +#define PRU1_CONTROL        *(unsigned int*)(PRU1_BASE + 0x0)
    +#define PRU1_STATUS         *(unsigned int*)(PRU1_BASE + 0x4)
    +
    +/*
     OnTargetConnect( )
     {
         GEL_TextOut("\tTarget Connected.\n","Output",1,1,1);
    @@ -246,6 +256,18 @@ OnTargetConnect( )
    
         Wake_DSP();
     }
    +*/
    +
    +OnPreFileLoaded()
    +{
    +
    +    // Enable the PRU in the PSC
    +    PSC0_LPSC_enable(0, LPSC_PRU);
    +
    +    // Reset the PRUs
    +    PRU0_CONTROL = 0;
    +    PRU1_CONTROL = 0;
    +}
    
     menuitem "Wake Core"
     hotmenu Wake_DSP()
    @@ -518,6 +540,7 @@ hotmenu PSC_All_On() {
         PSC0_LPSC_enable(0, LPSC_SCR0);
         PSC0_LPSC_enable(0, LPSC_SCR1);
         PSC0_LPSC_enable(0, LPSC_SCR2);
    +    PSC0_LPSC_enable(0, LPSC_ARM);
    
         // PSC1
         PSC1_LPSC_enable(0, LPSC_EDMA_CC1);
    

    Directions for loading a gel file in CCS can be found here:

    http://processors.wiki.ti.com/index.php/GEL#Loading_GEL_Files

    The intent is for the gel file to get the PRU into a good state before it attempts to load code.

    Note that I have not tested this out as I don't have a board handy.  I'm not sure if you can actually do all this while connected to the PRU.  On most devices you cannot even connect to the PRU until you have done these steps, so normally these are done while connected to another core.  From the conversation so far though, it sounds like you're able to actually connect to the PRU, but you can't get software to load.  So I'm hoping this will work.

    One quick test if this isn't working would be to simply open a memory window to 0x01C10800.  I'm curious if you actually see non-zero stuff in that area.  If so, then I think this all should work.  If not, we'll need you to connect to the ARM first to get things setup, and THEN load your code to the PRU.

  • Ok, I was able to get my hands on a board so that I could try this out and get it working.  I was not able to connect to the PRU at all to begin with.  Here's how I succeeded in connecting:

    1.  I connected to the ARM and loaded this gel file (slightly modified from my previous post):

    4807.OMAP-L138_LCDK.gel

    2. Verify the MMU is turned off.  This shows up in the CCS status bar in the bottom right corner.  It should say "MMU Off".  If it is not off, you can go to Tools -> ARM Advanced Features and uncheck the "MMU Enabled" box.

    3. Go to Scripts -> Wake Core -> Wake PRU.

    4. Connect to PRU.

    5. At that point I was able to load and execute an empty PRU program using the Linker Command file as discussed earlier.

  • Hi Brad,

    I am able to load binary with steps mentioned above and able to keep a breakpoint.

    Thanks
    Phani