NXP / harpoon-apps

Harpoon demo applications
Other
10 stars 4 forks source link

Jailhouse GPIO #1

Open majidBahmanigbt opened 11 months ago

majidBahmanigbt commented 11 months ago

Hi,

Hope you are all well.

I am working on the jailhouse of IMX8MP-EVK. I can enable the jailhouse and test the sample binary files. However, when I add GPIO to the code, the jailhouse enables properly but it doesn't work. Could you please tell me if there is any code modification requires in this regard?

I use:     RTOS : freertos     LINUX DEVICE TREE :   imx8mp-evk-harpoon.dtb, imx8mp-evk-harpoon-industrial.dtb     PIN: GPIO5_9  

code: https://github.com/majidBahmanigbt/Jailhouse_GPIO_Test/blob/master/freertos/main.c harpoon_set_configuration.sh: https://github.com/majidBahmanigbt/Jailhouse_GPIO_Test/blob/master/harpoon_set_configuration.sh

Thank you in advance for your help.

sviaunxp commented 11 months ago

Hi @majidBahmanigbt,

You may want to raise your question to community.nxp.com for a proper support from NXP.

In the meantime, note that if you want to use a peripheral such as GPIO5, this peripheral must be

  1. accessible in the RTOS cell
  2. MMU-mapped within the RTOS cell's config
  3. (eventually disabled in the Linux DTB to avoid conflict)

In your case, (1) should be OK because you seem to use the imx8mp-harpoon-freertos-industrial.cell config, which allows the GPIO5 access from the RTOS cell at the hypervisor level:

$ grep -e INDUS_MEMORY_REGIONS -e GPIO5 configs/arm64/imx8mp-rtos.h
#define RTOS_INDUS_MEMORY_REGIONS \
        MMIO_REGION_RWS(0x30240000, 0x30240000, KB(64)),   /* GPIO5 */  \

(2) doesn't seem to be respected. I do not see in your code any reference to GPIO5 base address MMU mapping. You may take the industrial application MMU_Init() function as example: BOARD_InitMemory() -> MMU_init() --> uses MMU_REGIONS --> uses APP_MMU_ENTRIES

Looking forward to helping you in the NXP Community portal!

Thanks, Stephane.

majidBahmanigbt commented 11 months ago

Thank you very much. Now it works.