Hi guys,
since BBB(Blue and PB1) and BBAI we was using the folowing method to load code to the PRU:
opening /dev/mem, stop pru - setting the CONTROL to 0, load hex code to the IRAM and start PRU using CONTROL.
I’m trying the same method to the PB2 but with no success.
I’m stoping the PRU but when loading the hex to the IRAM I’m always receiving a SIGBUS.
Using the PRUDEBUG I see the follow.
This is the HEX code:
const uint32_t PRUcode[] = {
0x240000c0,
0x24010080,
0x0504e0e2,
0x2eff818e,
0x230007c3,
0x240001ee,
0x23000ac3,
0x10c3c380,
0x1f07fefe,
0x20800000,
0x23000cc3,
0x21000b00,
0x10000000,
0x20c30000};
Running the program, just a part of the code is loaded to the IRAM of PRU
PRU0> DI 0x00000 128
Absolute addr = 0x34000, offset = 0x00000, Len = 128
[0x00000] c0 00 00 24 80 00 01 24-e2 e0 04 05 8e 81 ff 2e
[0x00010] c3 07 00 23 ee 01 00 24-c3 0a 00 23 80 c3 c3 10
[0x00020] 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
[0x00030] 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
[0x00040] 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
[0x00050] 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
[0x00060] 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
[0x00070] 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
If I load a bigger code - the total of loaded code increase but not enough for load all the code.
The code is simple:
printf("IRAM\n");
uint32_t *iram = (uint32_t*)mmap(0, 0x4000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, RCOUT_PRUSS_IRAM_BASE);
printf("CONTROL\n");
uint32_t *ctrl = (uint32_t*)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, RCOUT_PRUSS_CTRL_BASE);
*ctrl = 0;
memcpy(iram, PRUcode, sizeof(PRUcode)); // This is the part of the crash
any help will be appreciated,