Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Adafruit Metro M7 (SD and Airlift) #231

Open
alkavan opened this issue Aug 4, 2024 · 1 comment
Open

Add support for Adafruit Metro M7 (SD and Airlift) #231

alkavan opened this issue Aug 4, 2024 · 1 comment

Comments

@alkavan
Copy link

alkavan commented Aug 4, 2024

I just got couple of Metro M7 both SD and Airlift models.
Since the Metro M4 boards already added, perhaps adding the M7 boards shouldn't be much of an issue?
I can provide any information that is required for the configuration file, would have done myself if I knew how.

@alkavan
Copy link
Author

alkavan commented Aug 15, 2024

I tried adding the board to PlatformIO myself with some help from the AI. Platform IO was able to recognize the board, however I have no manage to make Zephyr to recognize it.

I think this should work for the most part, yet, I get this error when pio run:

No board named 'adafruit_metro_m7' found.

Please choose one of the following boards:

CMake Error at C:/Users/fish/.platformio/packages/framework-zephyr/cmake/modules/boards.cmake:167 (message):
  Invalid BOARD; see above.
Call Stack (most recent call first):
  C:/Users/fish/.platformio/packages/framework-zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  C:/Users/fish/.platformio/packages/framework-zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/Users/fish/.platformio/packages/framework-zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  C:/Users/fish/.platformio/packages/framework-zephyr/cmake/app/boilerplate.cmake:25 (find_package)
  CMakeLists.txt:2 (include)

platformio.ini

[env:adafruit_metro_m7]
platform = nxpimxrt
board = adafruit_metro_m7
framework = zephyr

board_build.mcu = imxrt1011
board_build.f_cpu = 500000000L

upload_protocol = jlink
debug_tool = jlink

; Zephyr-specific configurations
zephyr_board = adafruit_metro_m7
zephyr_extra_board_dirs = ${PROJECT_DIR}/zephyr/boards/arm

extra_scripts = pre:extra_script.py

adafruit_metro_m7.json

{
  "build": {
    "core": "nxp",
    "cpu": "cortex-m7",
    "f_cpu": "500000000L",
    "mcu": "MIMXRT1011DAE5A",
    "variant": "MIMXRT1011"
  },
  "debug": {
    "jlink_device": "MIMXRT1011DAE5A",
    "openocd_target": "imxrt1010.cfg"
  },
  "frameworks": [
    "zephyr"
  ],
  "name": "Adafruit Metro M7",
  "upload": {
    "maximum_ram_size": 131072,
    "maximum_size": 8388608,
    "protocol": "jlink"
  },
  "url": "https://www.adafruit.com/product/4950",
  "vendor": "Adafruit"
}

Kconfig.defconfig

if BOARD_ADAFRUIT_METRO_M7

config BOARD
    default "adafruit_metro_m7"

config SOC
    default "mimxrt1011dae5a"

config SYS_CLOCK_HW_CYCLES_PER_SEC
    default 500000000

endif # BOARD_ADAFRUIT_METRO_M7

Kconfig.board

config BOARD_ADAFRUIT_METRO_M7
    bool "Adafruit Metro M7"
    depends on SOC_SERIES_IMX_RT1010

if BOARD_ADAFRUIT_METRO_M7

config FLASH_SIZE
    default 8192

config FLASH_BASE_ADDRESS
    default 0x60000000

endif # BOARD_ADAFRUIT_METRO_M7

adafruit_metro_m7_defconfig

# Configuration for Adafruit Metro M7 board

if BOARD_ADAFRUIT_METRO_M7

config BOARD
    default "adafruit_metro_m7"

endif # BOARD_ADAFRUIT_METRO_M7

CONFIG_SOC_SERIES_IMX_RT1010=y
CONFIG_SOC_MIMXRT1011=y
CONFIG_BOARD_ADAFRUIT_METRO_M7=y

# Enable GPIO
CONFIG_GPIO=y

# Enable UART
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable MPU
CONFIG_ARM_MPU=y

# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y

# Clock configuration
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=500000000

# Enable pinmux
CONFIG_PINMUX=y

# Enable LED
CONFIG_LED=y

# Enable I2C (if your board uses it)
CONFIG_I2C=y

# Enable SPI (if your board uses it)
CONFIG_SPI=y

# Enable USB device stack (if your board supports USB)
CONFIG_USB_DEVICE_STACK=y

# Enable flash
CONFIG_FLASH=y

# Enable PWM (if your board supports it)
CONFIG_PWM=y

# Enable ADC (if your board has ADC capabilities)
CONFIG_ADC=y

# Enable DMA (if needed)
CONFIG_DMA=y

# Enable power management features (optional)
CONFIG_PM=y

# Enable FPU for Cortex-M7
CONFIG_FPU=y
CONFIG_FP_HARDABI=y

adafruit_metro_m7.dts

/dts-v1/;
#include <nxp/nxp_rt1010.dtsi>

/ {
	model = "Adafruit Metro M7";
	compatible = "adafruit,metro-m7", "nxp,mimxrt1011";

	chosen {
		zephyr,sram = &ocram;
		zephyr,itcm = &itcm;
		zephyr,console = &lpuart1;
		zephyr,shell-uart = &lpuart1;
	};

	aliases {
		led0 = &led_red;
		led1 = &led_green;
		led2 = &led_blue;
	};

	leds {
		compatible = "gpio-leds";
		led_red: led_0 {
			gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
			label = "Red LED";
		};
		led_green: led_1 {
			gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
			label = "Green LED";
		};
		led_blue: led_2 {
			gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
			label = "Blue LED";
		};
	};
};

&flexspi {
	status = "okay";
	flash0: flash@60000000 {
		compatible = "soc-nv-flash";
		reg = <0x60000000 DT_SIZE_M(8)>;
	};
};

&lpuart1 {
	status = "okay";
	current-speed = <115200>;
};

&lpspi1 {
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;
	/* Add your SPI devices here, for example:
	spi_device0: spi_device@0 {
		compatible = "manufacturer,device";
		reg = <0>;
		spi-max-frequency = <10000000>;
	};
	*/
};

&lpi2c1 {
	status = "okay";
};

&usb1 {
	status = "okay";
};

&gpio1 {
	status = "okay";
};

&gpio5 {
	status = "okay";
};

&adc1 {
	status = "okay";
};

&edma0 {
	status = "okay";
};

&gpt1 {
	status = "okay";
};

&gpt2 {
	status = "okay";
};

&flexpwm1 {
	status = "okay";
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants