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: Based on AM62x - Consultation on Devmem2 Tool Issues

Part Number: PROCESSOR-SDK-AM62X

A file system built on yocto, with built-in devmem2, can read odd addresses normally:

Devmem2 that directly self compiles cannot read odd addresses:

Devmem2 source code:GitHub - radii/devmem2: devmem2 - simple program to read/write from/to any location in memory.

Question: The phenomenon is quite confusing, and we hope that the original factory engineer can assist in answering what caused the problem.

  • A file system built on yocto, with built-in devmem2, can read odd addresses normally:

    If you look at the Yocto recipe for the devmem2 tool we are using in our SDKs located at ./meta-openembedded/meta-oe/recipes-support/devmem2/devmem2_2.0.bb...

    SUMMARY = "Simple program to read/write from/to any location in memory"
    LICENSE = "GPL-2.0-or-later"
    LIC_FILES_CHKSUM = "file://devmem2.c;endline=38;md5=a9eb9f3890384519f435aedf986297cf"
    
    SRC_URI = "git://github.com/denix0/devmem2.git;protocol=https;branch=main"
    SRCREV = "5b395a946894eb4f4ef5d07c80a50a88573a541e"
    
    S = "${WORKDIR}/git"
    
    CFLAGS += "-DFORCE_STRICT_ALIGNMENT"
    
    do_compile() {
        ${CC} -o devmem2 devmem2.c ${CFLAGS} ${LDFLAGS}
    }
    
    do_install() {
        install -d ${D}${bindir}
        install devmem2 ${D}${bindir}
    }

    You can find the server where it resides and the source revision https://github.com/denix0/devmem2

    Then if you notice how the Yocto recipe sets a build flag called FORCE_STRICT_ALIGNMENT, which when you look at the source code will explain the "more tolerant" behavior you observed:

    From https://github.com/denix0/devmem2/blob/main/devmem2.c ...

    static inline void *fixup_addr(void *addr, size_t size)
    {
    #ifdef FORCE_STRICT_ALIGNMENT
    	unsigned long aligned_addr = (unsigned long)addr;
    	aligned_addr &= ~(size - 1);
    	addr = (void *)aligned_addr;
    #endif
    	return addr;
    }

    Regards, Andreas

  • have access to