Hi Karl,

thanks for your help. I write my code to run in PRU1 and i generate two
file text.bin and data.bin. After i write file loader.c IN this file i
write this:


#define HWREG(x) (*((volatile unsigned int *)(x)))
#define SOC_PRCM_REGS                             (0x44E00000)
#define SOC_PRM_PER_REGS                          (SOC_PRCM_REGS + 0xC00)
#define SOC_CM_PER_REGS                           (SOC_PRCM_REGS + 0)
#define    PRUSS_CFG_BASE                            0x4a326000
#define PRU0CONTROL_PHYS_BASE                     0x4a322000
#define PRU0IRAM_PHYS_BASE                        0x4a334000
#define DATARAM0_PHYS_BASE                        0x01C30000
#define PRU_PHYS_BASE_CTRL                        0x0000
#define CM_PER_PRU_ICSS_CLKCTRL
(0x000000E8u)                 // set to 0x00000002 to enable/wake up
#define CM_PER_PRU_ICSS_CLKSTCTRL
(0x00000140u)                 // unset to 0x00000002 to enable/wake up
#define CM_PER_PRU_ICSS_CLKSTCTRL_UART_GCLK
(0x00000040u)                 // activate UART clock
#define CM_PER_PRU_ICSS_CLKSTCTRL_IEP_GCLK
(0x00000020u)                 // activate IEP clock
#define CM_PER_PRU_ICSS_CLKSTCTRL_OCP_GCLK
(0x00000010u)                 // activate OCP clock
#define PRUSS_CFG_BASE_SYSCFG                     0x0004
#define PRUSS_CFG_BASE_GPCFG0                     0x0008
#define PRUSS_CFG_BASE_GPCFG1                     0x000C
#define PRUSS_CFG_BASE_CGR                        0x0010
#define PRUSS_CFG_BASE_PIN_MX                     0x0040
#define PRUSS_CFG_BASE_PMAO                       0x0028

int main(])
{
    volatile int i=0;

   // reset the PRU, this may not be necessary in case of initial start-up
   HWREG(SOC_PRM_PER_REGS)|=0x00000002;
   while ((HWREG(SOC_PRM_PER_REGS) & 0x00000002) ==
0);                         //wait until reset was done

HWREG(SOC_PRM_PER_REGS)&=0xFFFFFFFD;
// clear reset bit

   // wake-up and nebale PRU, enable OCP-clock (mandatory)
   // UART and IEP clock have to be enabled here too when needed
   HWREG(SOC_CM_PER_REGS+CM_PER_PRU_ICSS_CLKCTRL)=0x00000002;

HWREG(SOC_CM_PER_REGS+CM_PER_PRU_ICSS_CLKSTCTRL)=(CM_PER_PRU_ICSS_CLKSTCTRL_OCP_GCLK);

   // have a short delay before next step
   while (i<10000)
   {
      i++;
   }

   HWREG(PRUSS_CFG_BASE+PRUSS_CFG_BASE_SYSCFG)=(0x00000005);
   while ((HWREG(PRUSS_CFG_BASE+PRUSS_CFG_BASE_SYSCFG) & 0x00000020)!=0);
// check wait state bit

   // copy text and data into PRU0 instruction and data RAM
   memcpy((void*)PRU0IRAM_PHYS_BASE, (void*)text_bin, sizeof(text_bin));
   memcpy((void*)DATARAM0_PHYS_BASE, (void*)data_bin, sizeof(data_bin));

   // set start address and execute
   HWREG(PRU0CONTROL_PHYS_BASE+PRU_PHYS_BASE_CTRL)|=0x04200000; // set
start address
   HWREG(PRU0CONTROL_PHYS_BASE+PRU_PHYS_BASE_CTRL)|=0x00000002; // execute

}

i have some question:
1) Why you write in code text_bin, data_bin and not text.bin, data.bin?
2) What this the command to compile this file(loader.c)?
3) This file loader.c and text.bin and data.bin must be in the same
directory?
4) This file is correct or there are a errors?

Thanks

Fabio

2015-04-13 8:37 GMT+02:00 Karl Karpfen <[email protected]>:

> Please read the beginning of this thread, there exactly this is described!
>
> 2015-04-10 11:48 GMT+02:00 Fabio Molon <[email protected]>:
>
>> Hi,
>> where i create this file and how compile this file? Can you give me an
>> example?
>> Thanks
>>
>> Fabio
>>
>> 2015-04-10 8:02 GMT+02:00 Karl Karpfen <[email protected]>:
>>
>>> Another i use the following comand : ./hexpru ../bin.cmd
>>>> <path_directory_my_project/project.out>. This create 2 binary file:
>>>> text.bin and data.bin. Now, what i do to run my program in AM3359?
>>>>
>>>>
>>> These two files belong to this part of code:
>>>
>>>    // copy text and data into PRU0 instruction and data RAM
>>>    memcpy((void*)PRU0IRAM_PHYS_BASE,(void*)text_bin,sizeof(text_bin));
>>>    memcpy((void*)DATARAM0_PHYS_BASE,(void*)data_bin,sizeof(data_bin));
>>>
>>> It is up to you how you load them, you can read them from flash and load
>>> them into PRU memory or you can convert them into a headerfile containing a
>>> large char-array which then is copied into PRU instruction/data RAM.
>>>
>>>
>>>  --
>>> For more options, visit http://beagleboard.org/discuss
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "BeagleBoard" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/beagleboard/rCO-2nKynVE/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "BeagleBoard" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/beagleboard/rCO-2nKynVE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beagleboard/rCO-2nKynVE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to