Page 1 of 2

Setting up a Nuvoton Nu-Maker-M032SE

Posted: 02 Jul 2022, 14:31
by nanoController
As a newb to the Nuvoton platform, I purchased a Nu-Maker-M032SE, which is an evaluation board for the m032 micro-controller (uC). This is a record of my initial fiddlings with it.

Where I am, and considering my time pressures, I got the board from digikey (as opposed to techDesign or Nuvoton Direct, which'd have shipped from Taiwan, at least in the latter case), which got here quickly.

As well, I got a programmer, to write compiled images with. As it turned out, though, the eval board comes with a mini-programmer, the Nu-Link2-Me. The one I purchased is the mid-tier one -- though developers are encouraged to use the latter, rather than the entry-level one. The options are:
https://www.nuvoton.com/tool-and-softwa ... rogrammer/

My focus is on the m031, though IIRC I did not find an eval board for it-- not in-stock anyway. So I am using an m032's, which is the same thing, except that it supports USB devices. (No, not the usb receptacle used to talk to the development host; I mean a usb device on the target product.)

The eval board's user manual is under
https://www.nuvoton.com/tool-and-softwa ... ion-board/


Other user manuals are under
https://www.nuvoton.com/products/microc ... nual&tab=2

There is a Quick Start in the eval board's manual. For linux, it's simple: I plugged the eval board into the development host's usb port, via a micro-usb cable. That resulted in 2 LEDs lighting up on the board: one on the main board itself, and one on the mini debugger. Linux immediately saw the device, and created a new file under /dev eg /dev/ttyACM0 . The baud rate to be used for the latter is 112500. So, minicom's command-line would be
minicom -D /dev/ttyACM0 -b 112500

Linux Eclipse was gotten from
https://www.nuvoton.com/tool-and-softwa ... -compiler/
or
https://www.nuvoton.com/products/microc ... &rt=Driver

IIRC that gives you the compiler toolchain as well.
Next, the eval board's manual says that you should get the BSP. Mine is under

https://www.nuvoton.com/tool-and-softwa ... t-package/

Next, I'll see if I can get a Hello World going, from Eclipse.

Re: Setting up a Nuvoton Nu-Maker-M032SE

Posted: 02 Jul 2022, 23:20
by nanoController
I forgot: Before connecting the usb, 2 dip-switches have to be toggled, in order to enable the serial (COM port) connection. These are shown in the eval board's manual, and on the upper left-hand side of the attached picture.

Setting up Eclipse, and the first project

Posted: 03 Jul 2022, 13:17
by nanoController
I mentioned where to get the Linux eclipse (Nu-Eclipse) from.
The version i got was
NuEclipse_V1.02.019_Linux_Setup.tar.gz

Once extracted, it contains a
NuEclipse_V1.02.019_Linux_Setup/install.sh

which must be run, and as a regular user ie non-root. It assumes that you have 'sudo' available and enabled; that basically/IIRC sets up a udev rule, and adds you to the plugdev group.
The install.sh creates a ~/local/ directory.

The extracted tree contains, within it, the toolchain, sample codes and various other things. The actual 'eclipse' executable is
NuEclipse_V1.02.019_Linux_Setup/eclipse/eclipse

which seems to be runnable from this location! I soft-linked to it, of course, which does work from any directory.

Now, the eval board's manual says to open a sample project, as your first project in eclipse. It points to a Template project under the BSP tree. Mine is
M031_Series_BSP_CMSIS_V3.05.000/SampleCode/Template/

(BTW, where should one place all these extractions? Good question! For now, the eclipse extraction seems to work from anywhere you place it. The BSP tree is something that I think you can open from within eclipse ie you don't have to tell it where the BSP tree is, though I may be wrong.
And the ~/local/ tree it creates itself.)

But the Template project need not be opened. The current version of eclipse already offers that via a more intuitive path:

eclipse > File > New > C/C++ Project > C Managed Build

which lists some hello-world projects, including a
Hello World Nuvoton Cortex-M Project

with a choice of the following toolchains :
Cross ARM GCC
Cross GCC
Linux GCC

This seems to be the proverbial Hello World, which is to write to UART. I've not built this yet, so that'll be in another post.

Re: Setting up a Nuvoton Nu-Maker-M032SE

Posted: 03 Jul 2022, 13:44
by nanoController
To ensure that eclipse has found your toolchain (which, after all, it _should_ because it comes _bundled_ with it), check

eclipse > Window > Preferences > C/C++ > Build > Global Tools Paths

This will show your paths. On Linux, "Build tools folder" should be blank.
And
eclipse > Window > Preferences > C/C++ > Run/Debug > OpenOCD Nu-Link

should have found ~/local/OpenOCD/bin

Re: Setting up a Nuvoton Nu-Maker-M032SE

Posted: 03 Jul 2022, 14:00
by nanoController
The Linux eclipse (Nu Eclipse) manual is indispensable. It has a lot of info, which I am following, step by step.

Re: Setting up a Nuvoton Nu-Maker-M032SE

Posted: 03 Jul 2022, 14:16
by nanoController
NuEclipse_V1.02.019_Linux_Setup/UserManual/UM_NuEclipse_EN.pdf
is the latest, April 2022, user manual for eclipse.

Re: Setting up a Nuvoton Nu-Maker-M032SE

Posted: 05 Jul 2022, 14:13
by nanoController
So far, I've not had success in building Hello World. The first error was that it could not find the file M031Series.h!
That is in

~/local/Packages/Nuvoton/NuMicro_DFP/1.3.15/Device/M031/Include/M031Series.h

NuEclipse_V1.02.019_Linux_Setup/eclipse/Packages/Nuvoton/NuMicro_DFP/1.3.15/Device/M031/Include/M031Series.h

M031_Series_BSP_CMSIS_V3.05.000/Library/Device/Nuvoton/M031/Include/M031Series.h

which are all the same file.
Curiously, there is also
~/eclipse-workspace/./Library/Device/Nuvoton/M031Series/Include/m031Series.h

which is different in only name. As the latter is iirc created by eclipse, and my version of eclipse is slightly more recent than the BSP, I'd have thought the lower-case name to be more recent. Yet, the compilation looks for the upper-case one! A mere rename might be called for.


Note: The Library/Device/Nuvoton/M031Series/Include/* which the BSP has is different from the one in ~/eclipse-workspace/! Unfortunately, I cannot tell which is more recent, since the file-dates of the latter had not been preserved, and the version numbers within are the same!!!!!

Re: Setting up a Nuvoton Nu-Maker-M032SE

Posted: 07 Jul 2022, 11:09
by nanoController
Before I forget:
I had trouble compiling the Hello World project! Just now, it built.

To cut to the chase:
. Somehow, -Werror and -Wconversion were set. I highly doubt that I set them, despite my predilection for the former. I know better than to set -Wconversion on a project that's not mine! De-selecting these helped.

. I had set Big Endian for the target. That choked because compilation links with objects that were built as Little Endian. Reverting the endian to the 'toolchain default' (ie Little), helped.

BTW, by default, the build log is stored in somewhere inane such as
~/eclipse-workspace/.metadata/.plugins/org.eclipse.cdt.ui/

Thankfully, that can be changed in Project Properties.

Re: Setting up a Nuvoton Nu-Maker-M032SE

Posted: 07 Jul 2022, 12:38
by nanoController
I realized where I had set -Werror. It was at project-creation!

When the sample-code project of Hello World is first created, it asks you some questions eg the flash and RAM of the target. The following are also selectable:

. Check most warnings
. Check some warnings
. -Werror

I think I selected them all, now knowing that they'd include -Wconversion!

Program file does not exist.

Posted: 21 Dec 2022, 09:07
by nanoController
"Program file does not exist."
was a persistent error, on both Linux and Windows, for the helloWorld sample-project. It is because, even though compilation successfully created
~/eclipse-workspace/helloWorld/Debug/helloWorld.elf

eclipse cannot find it! You have to go into
eclipse > helloWorld > Run > Debug Configurations > GDB Nuvoton Nu-Link Debugging > helloWorld Debug

Then, under its Main tab, click on
C/C++ Application

If that does not list the helloWorld.elf file, then click on Search Project, which should then find it.
viewtopic.php?f=21&t=10968 shows what the eclipse Console looks like when the elf image is written to the target.