Hi Raman,

Thank you for reviving this discussing (I'm CC NuttX mailing list
because it could interest one person or two).

On 11/14/23, Raman Gopalan <ramangopa...@gmail.com> wrote:
> Dear Alan, Greetings!
>
> I trust you're doing so well. I am so sorry about the long pause. I
> revisited NuttX again a couple of days ago. Many things have changed
> in the codebase. I had much trouble with AVR32 - and specifically,
> Mizar32 OR MCUZone's development kit in the context of NuttX. I will
> list my thoughts.
>
>   1) Initially, I tried GNU/Linux (Ubuntu - the latest); With the GNU
>   box, I changed parts of the build to a point where it compiles
>   without errors for AVR32. I had to transfer the built elf onto my
>   Windows machine to program the target with Atmel ICE. I am using
>   Microchip Studio.
>

Nice, I duplicated it here and confirmed it "works"

I cloned your repo [2] and copied it to /opt/avr32 and setup my PATH with it.

Then I run:

$ ./tools/configure.sh avr32dev1:nsh

And:

$ make
Create version.h
LN: platform/board to /home/alan/nuttxspace/apps/platform/dummy
Register: nsh
Register: sh
In file included from /home/alan/nuttxspace/nuttx/include/nuttx/sched_note.h:36,
                 from /home/alan/nuttxspace/nuttx/include/nuttx/trace.h:28,
                 from ./clock/clock_initialize.c:39:
/home/alan/nuttxspace/nuttx/include/nuttx/spinlock.h:36:23: error:
stdatomic.h: No such file or directory
ERROR: avr32-gcc failed: 1
       command: avr32-gcc -MT ./clock_initialize.o  -M '-fno-pic'
'-muse-rodata-section' '-fno-strict-aliasing' '-fomit-frame-pointer'
'-mpart=uc3b0256' '-isystem' '/home/alan/nuttxspace/nuttx/include'
'-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-pipe' '-I'
'/home/alan/nuttxspace/nuttx/sched' ./clock/clock_initialize.c
make[2]: *** [/home/alan/nuttxspace/nuttx/tools/Config.mk:228:
clock_initialize.ddc] Error 1
make[1]: *** [Makefile:70: .depend] Error 2
make: *** [tools/Unix.mk:611: pass2dep] Error 2

Solution: disabled RW_SPINLOCK:
# CONFIG_RW_SPINLOCK is not set

Alternatively if we get GCC >= 4.9 we could use stdatomic.h as well
-----------------------------------------------------------------------------------------------------------------

$ make
LN: platform/board to /home/alan/nuttxspace/apps/platform/dummy
Register: nsh
Register: sh
CC:  clock/clock.c as: loadlocale.c:130: _nl_intern_locale_data:
Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof
(_nl_value_type_LC_TIME[0]))' failed.
avr32-gcc: Internal error: Aborted (program as)
Please submit a full bug report.
See <http://www.atmel.com/avr> for instructions.
make[1]: *** [Makefile:60: clock.o] Error 1
make: *** [tools/LibTargets.mk:65: sched/libsched.a] Error 2

Solution: export LC_ALL=C
-----------------------------------------------------------------------------------------------------------------

$ make
CC:  assert/lib_assert.c cc1: error: unrecognized command line option "-fno-lto"
make[1]: *** [Makefile:153: bin/lib_assert.o] Error 1
make: *** [tools/LibTargets.mk:180: libs/libc/libc.a] Error 2

Solution: edited libs/libc/assert/Make.defs and removed no-lto
-----------------------------------------------------------------------------------------------------------------

$ make
Create version.h
CC:  stdlib/lib_strtold.c In file included from
/opt/avr32/bin/../lib/gcc/avr32/4.4.7/../../../../avr32/include/sys/reent.h:14,
                 from
/opt/avr32/bin/../lib/gcc/avr32/4.4.7/../../../../avr32/include/math.h:5,
                 from stdlib/lib_strtold.c:44:
/opt/avr32/bin/../lib/gcc/avr32/4.4.7/../../../../avr32/include/sys/_types.h:56:
error: conflicting types for '_ssize_t'
/home/alan/nuttxspace/nuttx/include/arch/avr32/types.h:82: note:
previous declaration of '_ssize_t' was here
make[1]: *** [Makefile:153: bin/lib_strtold.o] Error 1
make: *** [tools/LibTargets.mk:180: libs/libc/libc.a] Error 2

-----------------------------------------------------------------------------------------------------------------

And finally:

$ make
CC:  stdlib/lib_strtol.c stdlib/lib_strtol.c: In function 'strtol':
stdlib/lib_strtol.c:83: warning: integer overflow in expression
CC:  stdlib/lib_strtoll.c stdlib/lib_strtoll.c: In function 'strtoll':
stdlib/lib_strtoll.c:86: warning: integer overflow in expression
CC:  avr32/avr_doirq.c avr32/avr_doirq.c: In function 'avr_doirq':
avr32/avr_doirq.c:117: warning: assignment discards qualifiers from
pointer target type
CC:  avr32_bringup.c avr32_bringup.c:54:4: warning: #warning "Not Implemented"
LD: nuttx
CP: nuttx.hex

>   The debug symbols (references) were missing. I had to map them in
>   Microchip Studio. So painful. The LEDs on the MCUZone's AVR32
>   (at32uc3b0256) light up but I can't figure out what is happening. I
>   wasn't sure if I had missed any references while mapping the source
>   files. I can't trigger a breakpoint yet with this approach.
>

Oh, I think you missed to enable CONFIG_DEBUG_SYMBOLS at menuconfig:

Build Setup  --->
    Debug Options  --->
        [*] Generate Debug Symbols

Then I can see the debug_info are included:

$ file nuttx
nuttx: ELF 32-bit MSB executable, Atmel 32-bit family, version 1
(SYSV), statically linked, with debug_info, not stripped


>   2) I tried WSL for Windows. No luck. The problems take me back to
>   many issues on WSL's github. In the context of AVR32, I won't WSL
>   anymore. It is rather tricky to work with WSL in the context of
>   AVR32. I thought this path was less efficient. Win-10 + WSL-2.
>   It works great with STM32 targets though. :)
>

Yes, I used WSL in the past with STM32, ESP32 and XMC4, etc and it worked.

>   3) I finally got Cygwin; It is so pleasant! I am so happy with this
>   choice. I had to `Make' kconfig-frontend. I sought help from
>   [1]. It was very helpful. All perfect! :) But, I had a few more
>   problems: Can you please help here? I am just pasting the logs from
>   the Cygwin session from my machine:
>
> raman@foobar ~/nuttxspace/nuttx
> $ ./tools/configure.sh -c avr32dev1:nsh
>   Copy files
>   Select CONFIG_HOST_WINDOWS=y
>   Select CONFIG_WINDOWS_CYGWIN=y
>   Refreshing...
> CP: arch/dummy/Kconfig to
> /home/raman/nuttxspace/nuttx/arch/dummy/dummy_kconfig
> CP: boards/dummy/Kconfig to
> /home/raman/nuttxspace/nuttx/boards/dummy/dummy_kconfig
> LN: platform/board to /home/raman/nuttxspace/apps/platform/dummy
> LN: include/arch to arch/avr/include
> LN: include/arch/board to
> /home/raman/nuttxspace/nuttx/boards/avr/at32uc3/avr32dev1/include
> LN: drivers/platform to /home/raman/nuttxspace/nuttx/drivers/dummy
> LN: include/arch/chip to
> /home/raman/nuttxspace/nuttx/arch/avr/include/at32uc3
> LN: arch/avr/src/chip to /home/raman/nuttxspace/nuttx/arch/avr/src/at32uc3
> LN: arch/avr/src/board to
> /home/raman/nuttxspace/nuttx/boards/avr/at32uc3/avr32dev1/src
> #
> # configuration written to .config
> #
>
> raman@foobar ~/nuttxspace/nuttx
> $ make
> Create version.h
> LN: platform/board to /home/raman/nuttxspace/apps/platform/dummy
> Register: nsh
> Register: sh
> .\mkfatfs.c:25:26: error: nuttx/config.h: No such file or directory
> .\mkfatfs.c:27:23: error: sys/ioctl.h: No such file or directory
> .\mkfatfs.c:32:19: error: debug.h: No such file or directory
> .\mkfatfs.c:36:25: error: nuttx/fs/fs.h: No such file or directory
> .\mkfatfs.c:38:29: error: fsutils/mkfatfs.h: No such file or directory
> In file included from .\mkfatfs.c:39:
> .\/fat32.h:33:23: error: semaphore.h: No such file or directory
> .\/fat32.h:36:27: error: nuttx/kmalloc.h: No such file or directory
> ERROR: avr32-gcc failed: 1
>        command: avr32-gcc -MT
> .\\mkfatfs.c.home.raman.nuttxspace.apps.fsutils.mkfatfs.o  -M '-fno-pic'
> '-muse-rodata-section' '-fno-strict-aliasing' '-fomit-frame-pointer'
> '-mpart=uc3b0256' '-isystem'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/nuttx/include'
> '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-pipe' '-I'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/apps/include'
> .\\mkfatfs.c
> .\nsh_init.c:25:26: error: nuttx/config.h: No such file or directory
> .\nsh_init.c:27:26: error: sys/boardctl.h: No such file or directory
> .\nsh_init.c:28:26: error: nuttx/symtab.h: No such file or directory
> .\nsh_init.c:30:29: error: system/readline.h: No such file or directory
> .\nsh_init.c:31:27: error: nshlib/nshlib.h: No such file or directory
> In file included from .\nsh_init.c:33:
> .\/nsh.h:41:36: error: nuttx/usb/usbdev_trace.h: No such file or directory
> .\/nsh.h:122:4: error: #error "No NSH front end defined"
> In file included from .\nsh_init.c:34:
> .\/nsh_console.h:36:25: error: nuttx/queue.h: No such file or directory
> ERROR: avr32-gcc failed: 1
>        command: avr32-gcc -MT
> .\\nsh_init.c.home.raman.nuttxspace.apps.nshlib.o  -M '-fno-pic'
> '-muse-rodata-section' '-fno-strict-aliasing' '-fomit-frame-pointer'
> '-mpart=uc3b0256' '-isystem'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/nuttx/include'
> '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-pipe' '-I'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/apps/include'
> .\\nsh_init.c
> .\nsh_main.c:25:26: error: nuttx/config.h: No such file or directory
> .\nsh_main.c:31:26: error: sys/boardctl.h: No such file or directory
> .\nsh_main.c:35:27: error: nshlib/nshlib.h: No such file or directory
> ERROR: avr32-gcc failed: 1
>        command: avr32-gcc -MT
> .\\nsh_main.c.home.raman.nuttxspace.apps.system.nsh.o  -M '-fno-pic'
> '-muse-rodata-section' '-fno-strict-aliasing' '-fomit-frame-pointer'
> '-mpart=uc3b0256' '-isystem'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/nuttx/include'
> '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-pipe' '-I'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/apps/include'
> .\\nsh_main.c
> .\readline.c:25:26: error: nuttx/config.h: No such file or directory
> .\readline.c:30:29: error: system/readline.h: No such file or directory
> ERROR: avr32-gcc failed: 1
>        command: avr32-gcc -MT
> .\\readline.c.home.raman.nuttxspace.apps.system.readline.o  -M '-fno-pic'
> '-muse-rodata-section' '-fno-strict-aliasing' '-fomit-frame-pointer'
> '-mpart=uc3b0256' '-isystem'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/nuttx/include'
> '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-pipe' '-I'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/apps/include'
> .\\readline.c
> .\clock/clock_gettime.c:25:26: error: nuttx/config.h: No such file or
> directory
> .\clock/clock_gettime.c:31:19: error: debug.h: No such file or directory
> .\clock/clock_gettime.c:33:24: error: nuttx/arch.h: No such file or
> directory
> .\clock/clock_gettime.c:34:25: error: nuttx/sched.h: No such file or
> directory
> .\clock/clock_gettime.c:35:28: error: nuttx/spinlock.h: No such file or
> directory
> .\clock/clock_gettime.c:37:25: error: clock/clock.h: No such file or
> directory
> ERROR: avr32-gcc failed: 1
>        command: avr32-gcc -MT .\\clock_gettime.o  -M '-fno-pic'
> '-muse-rodata-section' '-fno-strict-aliasing' '-fomit-frame-pointer'
> '-mpart=uc3b0256' '-isystem'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/nuttx/include'
> '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-pipe' '-I'
> 'C:\\cygwin64\\home\\raman\\nuttxspace\\nuttx\\X/home/raman/nuttxspace/nuttx/sched'
> .\\clock/clock_gettime.c
> make[2]: *** [/home/raman/nuttxspace/nuttx/tools/Config.mk:228:
> clock_gettime.ddc] Error 1
> make[1]: *** [Makefile:70: .depend] Error 2
> make: *** [tools/Unix.mk:611: pass2dep] Error 2
>
>   Have you seen this before? Can you please give me your thoughts on
>   this? Has it to do with Unix/Windows paths?
>

I don't use Windows, but yes I think the issue is related to
Unix/Windows directories delimitator: "\" vs "/", etc.
I think there is some configuration on Cygwin to improve Linux/Unix
compatibility.

>   4) About support for AVR32 in the context of NuttX, I would really
>   love to help. I have the 32-bit (and 64-bit) toolchain ready for
>   CI. How may I help further? For now, I have put them here [2]. I
>   have tried this toolchain with eLua and RT-Thread.
>

I think adding the AVR32 support to CI will be very good to keep the
platform supported in the future.

BTW, if you saw the LED turned ON, it means that probably the NSH is
starting (otherwise you should see the LED blinking).

Do you think it is possible to gdb OpenOCD + GDB working for this MCU?

BR,

Alan

Reply via email to