Skip to content

Is Ambiq Apollo3 Blue mspi driver missing? #105729

@ant9000

Description

@ant9000

Describe the bug

I have a custom board designed around Ambiq Apollo3 Blue MCU, and would like to use an external flash connected to the MSPI controller. The DTS for my board is derived from zephyr/dts/arm/ambiq/ambiq_apollo3_blue.dtsi, and specifically I'm looking at making use of the mspi0 node, which is declared as

compatible = "ambiq,mspi";

Maybe I am missing something obvious, but as far as I can tell there is no driver at all taking care of this controller (despite the documented devicetree binding). If I add a jedec,spi-nor child node, linking fails with

[undefined reference to `__device_dts_ord_99'](ld.bfd: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_0_config+0x0): undefined reference to `__device_dts_ord_99')

For my project, ordinal 99 in devicetree_generated.h is precisely mspi0:

#define DT_N_S_soc_S_spi_40020000_PATH "/soc/spi@40020000"
#define DT_N_S_soc_S_spi_40020000_ORD 99

It very much looks like no driver initializes the mspi0 peripheral, so my thought was that I'm missing a CONFIG definition in my prj.conf: but I am not able to identify any driver exposing DT_DRV_COMPAT ambiq_mspi.

Modifying the mspi0 node as ambiq,mspi-controller does not work either: the corresponding driver is not written for Apollo3 but for Apollo3P.

I would very much like someone to show me that I'm dumb, and point me to the correct way of solving my issue.

Regression

  • This is a regression.

Steps to reproduce

cd zephyr/samples/basic/minimal
cat >boards/apollo3_evb.overlay <<EOF
&mspi0 {
    pinctrl-0 = <&mspi0_default>;
    pinctrl-names = "default";
    clock-frequency = <DT_FREQ_M(8)>;
    status = "okay";

    mx25r64: mx25r6435f@0 {
        compatible = "jedec,spi-nor";
        status = "okay";
        reg = <0>;
        size = <DT_SIZE_M(64)>; /* 64 Mbits */
        spi-max-frequency = <DT_FREQ_M(8)>;
        jedec-id = [c2 28 17];
    };
};
EOF
cat >boards/apollo3_evb.conf <<EOF
CONFIG_SPI=y
CONFIG_FLASH=y
EOF
west build -b apollo3_evb

Relevant log output

[7/12] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/ant9000/zephyrproject/zephyr/samples/basic/minimal/build/zephyr/zephyr_pre0.map 
: && ccache /home/ant9000/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc  -gdwarf-4 -Os zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map,/home/ant9000/zephyrproject/zephyr/samples/basic/minimal/build/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/lib/libc/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/lib/posix/c_lib_ext/liblib__posix__c_lib_ext.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/spi/libdrivers__spi.a  zephyr/drivers/timer/libdrivers__timer.a  modules/hal_ambiq/mcu/apollo3/lib..__modules__hal__ambiq__mcu__apollo3.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L/home/ant9000/zephyrproject/zephyr/samples/basic/minimal/build/zephyr  zephyr/arch/common/libisr_tables.a  -fuse-ld=bfd  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -mtp=soft  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  -Wl,--undefined=_sw_isr_table  -Wl,--undefined=_irq_vector_table  -specs=picolibc.specs  -DPICOLIBC_LONG_LONG_PRINTF_SCANF -L/home/ant9000/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp -lc -lgcc && cd /home/ant9000/zephyrproject/zephyr/samples/basic/minimal/build/zephyr && /usr/bin/cmake -E true
/home/ant9000/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_0_config+0x0): undefined reference to `__device_dts_ord_108'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/ant9000/zephyrproject/zephyr/samples/basic/minimal/build

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

-- OS: Debian 12
-- CMake version: 3.25.1
-- Zephyr version: 4.3.0
-- Zephyr toolchain: zephyr 0.16.8
-- West 1.2.0

Additional Context

No response

Metadata

Metadata

Type

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions