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.

PROCESSOR-SDK-AM62X: am62x Unaligned data access

Part Number: PROCESSOR-SDK-AM62X

SDK版本:09.02.01.10

内存区预留一块空间给应用程序使用

设备树里的内容如下

reserved-memory {
        #address-cells = <2>;
        #size-cells = <2>;
        ranges;

       /* 自定义预留空间 */
        cotrust_region: cotrust@fff00000 {
            no-map;            
            reg = <0x00 0xa0000000 0x00 0x00100000>; /* for cotrust */
        };
        
        ramoops@9c700000 {
            compatible = "ramoops";
            reg = <0x00 0x9c700000 0x00 0x00100000>;
            record-size = <0x8000>;
            console-size = <0x8000>;
            ftrace-size = <0x00>;
            pmsg-size = <0x8000>;
        };

        /* global cma region */
        linux,cma {
            compatible = "shared-dma-pool";
            reusable;
            size = <0x00 0x8000000>;
            linux,cma-default;
        };

        rtos_ipc_memory_region: ipc-memories@9c800000 {
            compatible = "shared-dma-pool";
            reg = <0x00 0x9c800000 0x00 0x00300000>;
            no-map;
        };

        mcu_m4fss_dma_memory_region: m4f-dma-memory@9cb00000 {
            compatible = "shared-dma-pool";
            reg = <0x00 0x9cb00000 0x00 0x100000>;
            no-map;
        };

        mcu_m4fss_memory_region: m4f-memory@9cc00000 {
            compatible = "shared-dma-pool";
            reg = <0x00 0x9cc00000 0x00 0xe00000>;
            no-map;
        };

        wkup_r5fss0_core0_dma_memory_region: r5f-dma-memory@9da00000 {
            compatible = "shared-dma-pool";
            reg = <0x00 0x9da00000 0x00 0x00100000>;
            no-map;
        };

        wkup_r5fss0_core0_memory_region: r5f-memory@9db00000 {
            compatible = "shared-dma-pool";
            reg = <0x00 0x9db00000 0x00 0x00c00000>;
            no-map;
        };

        secure_tfa_ddr: tfa@9e780000 {
            reg = <0x00 0x9e780000 0x00 0x80000>;
            alignment = <0x1000>;
            no-map;
        };

        secure_ddr: optee@9e800000 {
            reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */
            alignment = <0x1000>;
            no-map;
        };
        
        
    };

/*
 * ioremap() and friends.
 *
 * ioremap() takes a resource address, and size.  Due to the ARM memory
 * types, it is important to use the correct ioremap() function as each
 * mapping has specific properties.
 *
 * Function        Memory type    Cacheability    Cache hint
 * ioremap()        Device        n/a        n/a
 * ioremap_cache()    Normal        Writeback    Read allocate
 * ioremap_wc()        Normal        Non-cacheable    n/a
 * ioremap_wt()        Normal        Non-cacheable    n/a
 *
 * All device mappings have the following properties:
 * - no access speculation
 * - no repetition (eg, on return from an exception)
 * - number, order and size of accesses are maintained
 * - unaligned accesses are "unpredictable"
 * - writes may be delayed before they hit the endpoint device
 *
 * All normal memory mappings have the following properties:
 * - reads can be repeated with no side effects
 * - repeated reads return the last value written
 * - reads can fetch additional locations without side effects
 * - writes can be repeated (in certain cases) with no side effects
 * - writes can be merged before accessing the target
 * - unaligned accesses can be supported
 * - ordering is not guaranteed without explicit dependencies or barrier
 *   instructions
 * - writes may be delayed before they hit the endpoint memory
 *
 * The cache hint is only a performance hint: CPUs may alias these hints.
 * Eg, a CPU not implementing read allocate but implementing write allocate
 * will provide a write allocate mapping instead.
 */

驱动中使用  ioremap_wt()映射,

对映射的内存中定义

__packed struct foo

  {

     char one;

     short two;

     char three;

     int four;

  } ;

 struct  foo pa;

 void TestPacked(void)

 {

    pa.one = 1;

pa.two = 2;

pa.three = 3;

pa.four = 4;

}

运行程序会异常,报  “invalid address alignment”

请问在am62x 中如何打开 Unaligned data access