Hi Tomek, Great to see NuttX running on the RobotDyn Mega 2560 PRO!
A few notes regarding adding `ostest` and tuning the footprint on the ATmega2560: 1. OSTest duration and PR #3809: If you add an `ostest` configuration, you may want to cherry-pick or watch apps PR #3809 (https://github.com/apache/nuttx-apps/pull/3809, addressing #3620). It restores the default round-robin getprime search range from 30,000 to 10,000 and runs from 10 to 4. On a 16 MHz 8-bit AVR, the previous defaults would cause the round-robin test to stall for a very long time in trial division loops. With the reduced parameters, it runs in seconds while still validating round-robin context switching. 2. Fitting in 8KB RAM: The default OSTest stack size (`CONFIG_TESTING_OSTEST_STACKSIZE`) is 8192, which alone would consume the entire SRAM. Reducing `CONFIG_TESTING_OSTEST_STACKSIZE` to 512 or 768 bytes and setting `CONFIG_TESTING_OSTEST_NBARRIER_THREADS` to a smaller value (e.g., 3 or 4 instead of 8) should comfortably allow `ostest` to fit alongside the OS in 8KB RAM. 3. Trimming the 71KB Flash footprint: In `boards/avr/atmega/arduino-mega2560/configs/nsh/defconfig`: - `CONFIG_DEBUG_OPT_UNUSED_SECTIONS` is currently unset (`# CONFIG_DEBUG_OPT_UNUSED_SECTIONS is not set`). Enabling it passes `-ffunction-sections -fdata-sections -Wl,--gc-sections`, which strips unused symbols and functions from the AVR ELF. - Disabling floating-point printf in libc (`CONFIG_LIBC_FLOATINGPOINT=n`) and building without debug symbols (`CONFIG_DEBUG_SYMBOLS=n`) can also recover significant flash space on AVR. Best regards, Swatantra On Mon, 5 Oct 2026 at 22:56, Tomek CEDRO <[email protected]> wrote: > Okay, I found and played with RobotDyn Mega 2560 PRO (Embed) / > Atmega2560-16AU chip [1], it has onboard CH340 for flashing that works > with avrdude, just additional UART2USB board is required, using as > Arduino-Mega2560, builds fine, flashes fine, runs fine so far with > only bare nsh no commands no ostest, will add board and ostest config > if that fits in 8K RAM :-) > > Also need to review config because that bare nsh shouold not use 71KB > of flash :-) > > avr-gcc (GCC) 14.2.0 > Copyright (C) 2024 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > % /usr/bin/time -h ./tools/configure.sh -B arduino-mega2560:nsh > % gmake CROSSDEV=avr- > (..) > Memory region Used Size Region Size %age Used > flash: 71642 B 256 KB 27.33% > sram: 2718 B 8 KB 33.18% > eeprom: 0 B 4 KB 0.00% > 2,06s real 17,83s user 7,04s sys > > [1] https://robotdyn.com/mega-2560-pro-embed-ch340g-atmega2560-16au > > % avrdude -v -V -p atmega2560 -c wiring -P /dev/cuaU0 -D -U > flash:w:nuttx.elf:e > Avrdude version 8.2 > Copyright see https://github.com/avrdudes/avrdude/blob/main/AUTHORS > > System wide configuration file is /usr/local/etc/avrdude.conf > User configuration file is /home/XXX/.avrduderc > Warning: programmer xplainedmini_twi fails to specify prog_modes = > PM_...; [/usr/home/XXX/.avrduderc:357] > > Using port : /dev/cuaU0 > Using programmer : wiring > AVR part : ATmega2560 > Programming modes : SPM, ISP, HVPP, JTAG > Programmer type : Wiring > Description : Wiring bootloader using STK500 v2 protocol > Programmer model : AVRISP > HW version : 15 > FW version controller : 2.10 > SCK period : 0.1 us > > AVR device initialized and ready to accept instructions > Device signature = 1E 98 01 (ATmega2560) > Reading 71642 bytes for flash from input file nuttx.elf > in 1 section [0, 0x117d9]: 280 pages and 38 pad bytes > Writing 71642 bytes to flash > Writing | ################################################## | 100% 22.19s > 71642 bytes of flash written > Avrdude done. Thank you. > > % cu -l /dev/cuaU1 -s 38400 > Connected > NuttShell (NSH) NuttX-13.1.0 > nsh> uname -a > nsh: uname: command not found > nsh> help > help usage: help [-v] [<cmd>] > > ? help > nsh> > > :-) > > -- > CeDeROM, SQ7MHZ, http://www.tomek.cedro.info >
