IPCF of s32g2 debugging error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IPCF of s32g2 debugging error

Jump to solution
1,792 Views
fenghua_jiang
Contributor IV

HI Team,

    I have a question about testing IPCF on board of S32g274.

  Test Model is Figure 4 IPCF use case for Linux user-space.

The source code and samples of IPCF implementation for Linux drivers are published on:

https://source.codeaurora.org/external/autobsps32/ipcf/ipc-shm-us/

The branch: release/bsp32.0

failed print:

When the test run generate_msg,it print "Bus error".

I test the model IPCF use case for Linux Kernel is OK.

Just modify the function generate_msg:

static void generate_msg(char *dest, int len, int msg_no)
{
static char *msg_pattern = " Test all test from kernel!\n";

snprintf(dest, len, "#%d %s\n", msg_no, msg_pattern);
sample_info("generate_msg is %s!\n",dest);
}

Do you have any suggest?

regards,

jiang

0 Kudos
Reply
1 Solution
1,718 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Thanks for your feedback.

We will continue searching the reason and if there is a workaround.

We thank you for your patience.

View solution in original post

0 Kudos
Reply
9 Replies
1,772 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Prior to understanding your application, what is the setup you are running? A53 with M7?

Before the modification, your application was running no problem?

Have you run the IPCF example provided (A53 with M7)? Did you have problems?

Please, let us know.

0 Kudos
Reply
1,767 Views
fenghua_jiang
Contributor IV

Hi ,

IPCF_SHM_User_Manual.pdf

6.2.4 Running the application
1. Copy ipc-shm-sample.elf to the target board rootfs. In case of building the sample manually, also
copy IPC UIO kernel module (ipc-shm-uio.ko) to the directory provided during compilation via
IPC_UIO_MODULE_DIR.
Notes: IPC UIO kernel module must be located in the same directory as provided via IPC_UIO_MODULE_DIR
when building the sample.
2. Boot Linux: for silicon, see section “How to boot” from Auto Linux BSP user manual.
3. Run sample and then specify the number of ping messages to be exchanged with peer when prompted:
./ipc-shm-sample.elf
Input number of messages to send:
Notes: To exit the sample, input number of messages 0 or send interrupt signal (e.g. Ctrl + C)

print:

ipc-shm-us-lib: ipc_os_init(): Loading ./ipc-shm-uio.ko with params: inter_core_tx_irq=2 inter_core_rx_irq=1 remote_core=1,1 local_core=6,1,15
Input number of messages to send: 10
ipc-shm-us-app: ch 0 >> 20 bytes: SENDING MESSAGES: 10
ipc-shm-us-app: ch 1 >> 32 bytes: #0 HELLO WORLD!
ipc-shm-us-app: ch 1 << 32 bytes: #0 HELLO WORLD!
ipc-shm-us-app: ch 2 >> 32 bytes: #1 HELLO WORLD!
ipc-shm-us-app: ch 2 << 32 bytes: #1 HELLO WORLD!
ipc-shm-us-app: ch 1 >> 32 bytes: #2 HELLO WORLD!
ipc-shm-us-app: ch 1 << 32 bytes: #2 HELLO WORLD!
ipc-shm-us-app: ch 2 >> 32 bytes: #3 HELLO WORLD!
ipc-shm-us-app: ch 2 << 32 bytes: #3 HELLO WORLD!
ipc-shm-us-app: ch 1 >> 32 bytes: #4 HELLO WORLD!
ipc-shm-us-app: ch 1 << 32 bytes: #4 HELLO WORLD!
ipc-shm-us-app: ch 2 >> 32 bytes: #5 HELLO WORLD!
ipc-shm-us-app: ch 2 << 32 bytes: #5 HELLO WORLD!
ipc-shm-us-app: ch 1 >> 32 bytes: #6 HELLO WORLD!
ipc-shm-us-app: ch 1 << 32 bytes: #6 HELLO WORLD!
ipc-shm-us-app: ch 2 >> 32 bytes: #7 HELLO WORLD!
ipc-shm-us-app: ch 2 << 32 bytes: #7 HELLO WORLD!
ipc-shm-us-app: ch 1 >> 32 bytes: #8 HELLO WORLD!
ipc-shm-us-app: ch 1 << 32 bytes: #8 HELLO WORLD!
ipc-shm-us-app: ch 2 >> 32 bytes: #9 HELLO WORLD!
ipc-shm-us-app: ch 0 << 20 bytes: REPLIED MESSAGES: 10
ipc-shm-us-app: ch 2 << 32 bytes: #9 HELLO WORLD!
ipc-shm-us-app: exit

ipc-shm-us/sample/sample.c

static void generate_msg(char *dest, int len, int msg_no)
{
static char *msg_pattern = "HELLO WORLD!";

snprintf(dest, len, "#%d %s\0", msg_no, msg_pattern);
}

modify

static void generate_msg(char *dest, int len, int msg_no)
{
static char *msg_pattern = "HELLO WORLD From Kernel!";

snprintf(dest, len, "#%d %s\0", msg_no, msg_pattern);
}

print:

ipc-shm-us-lib: ipc_os_init(): Loading ./ipc-shm-uio.ko with params: inter_core_tx_irq=2 inter_core_rx_irq=1 remote_core=1,1 local_core=6,1,15
ipc-shm-us-lib: ipc_os_init(): Created Rx softirq thread with priority=99

Bus error

0 Kudos
Reply
1,757 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Did you unmount the module prior to the modification? Is this only happening when adding more characters to the string? Or also when removing?

Please, let us know

0 Kudos
Reply
1,754 Views
fenghua_jiang
Contributor IV

HI ,

Did you unmount the module prior to the modification?

Yes,I unmounted the module.

 If I unmount the module,the test run failed(Can't load ipc-shm-uio module).

Is this only happening when adding more characters to the string?

Yes, it is. The test will run failed just adding more characters to the string.

regards,

jiang

 

0 Kudos
Reply
1,731 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Given that the BUS Error could be related to memory alignment, and the following is said in the user manual:

"This driver provides direct access to physical memory that is mapped as non-cachable. Therefore, applications should make only aligned accesses in the shared memory buffers. Caution should be used when working with functions that may do unaligned accesses (e.g., string processing functions)." [IPCF User Manual, Rev 1.17, 05/2022].

Have you verified that no un-aligned access is being made with your modification?

Also, the modification you made prints a string that does not appears on the other non-modified program:

"ipc-shm-us-lib: ipc_os_init(): Created Rx softirq thread with priority=99"

Is something else being modified?

You are telling that adding causes this behavior, reducing the characters does the same? Changing the string to "HELLO!" bring the same situation?

Also, you are telling that you run the program once (which runs as expected) then you modify it and fails, have you tried to modify the program prior to running it once? Does it happen again?

We will continue searching for what could be happening, but please let us know.

0 Kudos
Reply
1,676 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

We do apologize for or delay, we have the following comments:

"This issue is leaded by unaligned memory access in generate_msg function. The snprintf function once will copy 128bits data to memory, it may lead to unaligned access.

The simple workaround is that customer's code only copy 1 byte into share memory in each access, such as using a FOR loop. "

Again, we do apologize for our delay.

Please, let us know.

0 Kudos
Reply
1,724 Views
fenghua_jiang
Contributor IV

Hi,

 Thank you for your reply.

"This driver provides direct access to physical memory that is mapped as non-cachable. Therefore, applications should make only aligned accesses in the shared memory buffers. Caution should be used when working with functions that may do unaligned accesses (e.g., string processing functions)." [IPCF User Manual, Rev 1.17, 05/2022].

Have you verified that no un-aligned access is being made with your modification?

Also, the modification you made prints a string that does not appears on the other non-modified program:

"ipc-shm-us-lib: ipc_os_init(): Created Rx softirq thread with priority=99"

Is something else being modified?

Re: I just modify the char (msg_pattern).

 

You are telling that adding causes this behavior, reducing the characters does the same? Changing the string to "HELLO!" bring the same situation?

Re: I test the example.

If I reduce the characters,the test runs successfully.

The test runs fails when the size of the character exceeds 13(add ‘#%d ' all 16).

Also, you are telling that you run the program once (which runs as expected) then you modify it and fails, have you tried to modify the program prior to running it once? Does it happen again?

Re: Yes,I modify the program then run it ,and it happened again.

regards,

jiang

 

 

0 Kudos
Reply
1,719 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Thanks for your feedback.

We will continue searching the reason and if there is a workaround.

We thank you for your patience.

0 Kudos
Reply
1,768 Views
fenghua_jiang
Contributor IV

Hi,

   I run  the IPCF example provided A53.

  The model isScreenshot from 2023-02-08 09-05-06.png

 

0 Kudos
Reply