Hi @Montecri ,
Please upgrade your Embeetle installation to version 1.2.2
. Then create a new project for the ch32v307vct6-evt-r1
board. You will notice that this project has a lot of sample projects inside the <project>/source/Samples
folder. All of them are deactivated by default - except for the GPIO
sample project. That’s the “Blinky LED” project. It’s the active one, because it is an easy way to get something working on your board:
You expressed your interest in the Ethernet functionality. Therefore, I’ll guide you in this post how you can activate the ethernet functionality properly.
STEP 1: Deactivate current project
Right-click on the GPIO
folder and select Force exclude
:
Wait a few seconds for the Source Analyzer to complete the project analysis (a green progressbar in the bottom-right corner indicates that).
STEP 2: Activate the ethernet project
Navigate to the Ethernet sample project you want to activate. For example the ETH/UdpServer
folder:
Right-click the folder and select Automatic
in the menu. Embeetle will now figure out which files from this folder are needed for successful compilation:
Unfortunately, there are still a few project errors in the Diagnostics tab:
We’ll solve that in the next step.
STEP 3: Go hunting for 'missing symbols'
The errors you see in the Diagnostics tab are all ‘undefined global symbols’. In other words: you have activated a sample project, but not all source files are available to Embeetle yet. Some source files needed for a successful compilation are still missing.
So now we need to go hunting for these “missing symbols”. They turn out to be in the NetLib
folder, located at <project>/source/Samples/ETH/NetLib
. Put this folder also on Automatic
mode:
Great, but now the Diagnostics tab shows hundreds of multiply defined globals! We have the opposite problem here: several symbols are defined in multiple places. That’s because the following two library files are fighting each other:
libwchnet.a
libwchnet_float.a
They can’t coexist. You have to choose one. Choose the libwchnet.a
library (the other one has a few issues). Force exclude libwchnet_float.a
(right-click and select ‘Force exclude’):
Great! Now the Diagnostics tab shows no more errors. Just a few warnings, but they are pretty harmless:
The build should work now:
STEP 4: Add some libraries
To be sure I didn’t miss anything, I ran the project in Mounriver Studio (the Eclipse-based IDE from WCH). I noticed they added the following libraries to the linker command:
-lm
-lwchnet
-lprintf
The linker is notified here that it can look for these libraries in the compiler toolchain:
-lm
: mathematics library
-lwchnet
: wchnet library
-lprintf
: printf library
If you want to pass them in Embeetle IDE, you should open the file <project>/config/dashboard.mk
and navigate to line 127:
Add them to the TOOLCHAIN_LDLIBS
variable. Our makefile
imports this dashboard.mk
file and will use this variable to know which libraries to look for in the compiler toolchain when launching the linker.
However, The compiler toolchain in Mounriver Studio is slightly different from the one used in Embeetle IDE. It would lead us too far here to dive into all the details. Point is: the compiler used in Embeetle IDE has no built-in wchnet
and printf
libraries. So you should remove those. Keep only the maths library:
No worries though. The build works because the wchnet
library is provided at this location:
As you can see, this library is automatically selected and fed to the linker. As for the printf
library - there seems to be no compilation issue either.