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.
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.
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.
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.
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?
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.
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:
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):
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.