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

boards: esp32: Add support for M5Stack AtomS3 #64434

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

kartben
Copy link
Collaborator

@kartben kartben commented Oct 26, 2023

This introduces support for the ESP32S3 based M5Stack AtomS3.

Tested all of the following:

  • LCD display and accelerometer tested with samples/modules/lvgl/accelerometer_chart, which works out-of-the-box (see below!)
  • Button (samples/basic/button and samples/subsys/display/lvgl sample)
  • Bluetooth (samples/bluetooth/peripheral_hr)
  • Wi-Fi (samples/net/wifi, wifi scan works)
  • Grove connector, tested with samples/sensor/sensor_shell and an I2C device attached

Doc page: https://builds.zephyrproject.io/zephyr/pr/64434/docs/boards/xtensa/m5stack_atoms3/doc/index.html

Pxl.20231026.101330936.webm

@kartben kartben force-pushed the m5stack_atoms3 branch 8 times, most recently from 9f1f09e to 1eccaec Compare October 26, 2023 17:44
@kartben kartben marked this pull request as ready for review October 26, 2023 17:45
@kartben
Copy link
Collaborator Author

kartben commented Oct 26, 2023

The first two commits are part of PR #64451 so you may ignore them.

@sylvioalves
Copy link
Collaborator

@kartben awesome!

sylvioalves
sylvioalves previously approved these changes Oct 27, 2023
@kartben
Copy link
Collaborator Author

kartben commented Oct 27, 2023

Rebased as the 2 commits mentioned earlier are not needed anymore now that 1fac5ed fixed the issue with Xtensa CI.

sylvioalves
sylvioalves previously approved these changes Oct 28, 2023
@kartben
Copy link
Collaborator Author

kartben commented Oct 28, 2023

@sylvioalves should I exclude this board from tests/lib/heap testcase, like other (but not all??) esp32-s2 and s3? I don't think the test failed in earlier runs though, but not 100% sure.

@kartben
Copy link
Collaborator Author

kartben commented Nov 9, 2023

@sylvioalves @marekmatej what should I be doing with the failing heap test? should I just add this board as a platform_exclude in the testcase? There are other ESP32S3 that are working just fine (but also some that are excluded).

FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /__w/zephyr/zephyr/twister-out/m5stack_atoms3/tests/lib/heap/libraries.heap/zephyr/zephyr_pre0.map 
: && ccache /opt/toolchains/zephyr-sdk-0.16.3/xtensa-espressif_esp32s3_zephyr-elf/bin/xtensa-espressif_esp32s3_zephyr-elf-gcc  -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/xtensa/core/offsets/offsets.c.obj  -fuse-ld=bfd  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/__w/zephyr/zephyr/twister-out/m5stack_atoms3/tests/lib/heap/libraries.heap/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/xtensa/core/libarch__xtensa__core.a  zephyr/lib/libc/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/lib/posix/liblib__posix.a  zephyr/subsys/random/libsubsys__random.a  zephyr/subsys/testsuite/ztest/libsubsys__testsuite__ztest.a  zephyr/drivers/interrupt_controller/libdrivers__interrupt_controller.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/entropy/libdrivers__entropy.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/regulator/libdrivers__regulator.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/opt/toolchains/zephyr-sdk-0.16.3/xtensa-espressif_esp32s3_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s3_zephyr-elf/12.2.0"  -L/__w/zephyr/zephyr/twister-out/m5stack_atoms3/tests/lib/heap/libraries.heap/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -lgcc  -Wl,--fatal-warnings  -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  -DPICOLIBC_INTEGER_PRINTF_SCANF  -T/__w/zephyr/modules/hal/espressif/zephyr/esp32s3/src/linker/esp32s3.rom.alias.ld  -T/__w/zephyr/modules/hal/espressif/zephyr/esp32s3/../../components/esp_rom/esp32s3/ld/esp32s3.rom.ld  -T/__w/zephyr/modules/hal/espressif/zephyr/esp32s3/../../components/esp_rom/esp32s3/ld/esp32s3.rom.api.ld  -T/__w/zephyr/modules/hal/espressif/zephyr/esp32s3/../../components/esp_rom/esp32s3/ld/esp32s3.rom.libgcc.ld  -T/__w/zephyr/modules/hal/espressif/zephyr/esp32s3/../../components/esp_rom/esp32s3/ld/esp32s3.rom.newlib.ld  -T/__w/zephyr/modules/hal/espressif/zephyr/esp32s3/../../components/esp_rom/esp32s3/ld/esp32s3.rom.version.ld  -T/__w/zephyr/modules/hal/espressif/zephyr/esp32s3/../../components/soc/esp32s3/ld/esp32s3.peripherals.ld  -Wl,--wrap=k_calloc  -Wl,--wrap=k_malloc  --specs=picolibc.specs  -lc  -lgcc && cd /__w/zephyr/zephyr/twister-out/m5stack_atoms3/tests/lib/heap/libraries.heap/zephyr && /usr/bin/cmake -E true
/opt/toolchains/zephyr-sdk-0.16.3/xtensa-espressif_esp32s3_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s3_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s3_zephyr-elf/bin/ld.bfd: zephyr/zephyr_pre0.elf section `.dram0.data' will not fit in region `dram0_0_seg'
/opt/toolchains/zephyr-sdk-0.16.3/xtensa-espressif_esp32s3_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s3_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s3_zephyr-elf/bin/ld.bfd: region `dram0_0_seg' overflowed by 1536 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

CONFIG_UART_CONSOLE=y

# for debugging
CONFIG_SHELL=y
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest removing this as default config. This will allow test/lib/heap to pass. User can manually enable this if necessary. Sounds good?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing! Definitely the right thing to do. Pretty sure I copy pasted from another esp32 board fwiw, including the "for debugging" comment.


CONFIG_MAIN_STACK_SIZE=2048

CONFIG_ESP_HEAP_MEM_POOL_REGION_1_SIZE=0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed nor available for ESP32S3. Only for ESP32 that has dual ram bank. So you can remove it from here.

@sylvioalves
Copy link
Collaborator

sylvioalves commented Nov 9, 2023

@sylvioalves should I exclude this board from tests/lib/heap testcase, like other (but not all??) esp32-s2 and s3? I don't think the test failed in earlier runs though, but not 100% sure.

If you remove the CONFIG_SHELL=y, test will pass.

@kartben
Copy link
Collaborator Author

kartben commented Nov 9, 2023

@sylvioalves should I exclude this board from tests/lib/heap testcase, like other (but not all??) esp32-s2 and s3? I don't think the test failed in earlier runs though, but not 100% sure.

If you remove the CONFIG_SHELL=y, test will pass.

Thanks for your help! All green now!
Let me know who else you think could help reviewing this PR btw, as it hasn't had a lot of traction in the past two weeks. Thanks!

sylvioalves
sylvioalves previously approved these changes Nov 9, 2023
@sylvioalves
Copy link
Collaborator

@marekmatej @LucasTambor PTAL

This introduces support for the ESP32S3 based M5Stack AtomS3.

Signed-off-by: Benjamin Cabé <[email protected]>
s/espressif/extensa/ for the couple M5Stack boards in-tree that had the
wrong vendor set.

Signed-off-by: Benjamin Cabé <[email protected]>
Copy link

@marekmatej marekmatej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some nitpicks, but looks good

if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
set(OPENOCD OPENOCD-NOTFOUND)
endif()
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since debugging is not supported, maybe consider reducing this file to single line:
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)

pinmux = <SPIM2_MOSI_GPIO21>;
output-low;
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove blank line

@carlescufi carlescufi merged commit 1fbcccd into zephyrproject-rtos:main Nov 14, 2023
16 checks passed
@kartben kartben deleted the m5stack_atoms3 branch November 15, 2023 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants