arduino12 / n76e003_platformio

Nuvoton MCUs (N76E003) example project with PlatformIO
13 stars 13 forks source link

Compilation fails with "unnamed prototyped parameters not allowed when body is present" error #2

Closed vishnumaiea closed 2 years ago

vishnumaiea commented 2 years ago

I was trying to compile your examples without any modifications. But the compilation fails with a few error messages.

image

I have the MCS-51 toolchain installed. The N76E003.h is the only file with errors and warnings. Am I missing something here?

Below is the log from terminal window.

> Executing task: C:\.PIO\penv\Scripts\platformio.exe run --environment n76e003 <

Processing n76e003 (platform: https://github.com/arduino12/platform-intel_mcs51.git; board: n76e003)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/intel_mcs51/n76e003.html
PLATFORM: Intel MCS-51 (8051) (1.2.3+sha.2d7556b) > Generic N76E003
HARDWARE: N76E003 16MHz, 1KB RAM, 18KB Flash
PACKAGES: 
 - tool-stcgal 1.104.0 (1.4) 
 - toolchain-sdcc 1.30804.10766 (3.8.4)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <N76E003>
Building in release mode
Compiling .pio\build\n76e003\src\main.rel
Compiling .pio\build\n76e003\lib634\N76E003\Common.rel
Compiling .pio\build\n76e003\lib634\N76E003\Delay.rel
Archiving .pio\build\n76e003\lib634\libN76E003.lib
*** [.pio\build\n76e003\lib634\libN76E003.lib] Error 3221225781
==================================================================== [FAILED] Took 0.70 seconds ====================================================================
The terminal process "C:\.PIO\penv\Scripts\platformio.exe 'run', '--environment', 'n76e003'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.
arduino12 commented 2 years ago

Hi,

Did you follow these steps? I just cloned this repo and the project compiles without a problem (WIN10):

image Make sure you have added the whole folder to VS code like I just did :)

Let us know how you solve it so others can learn!

vishnumaiea commented 2 years ago

Yes, I followed the steps you have given and opened the whole folder as a PlatformIO project. The whole window looks like this.

image

But I am on Windows 11. Not sure if that's supposed to cause any issues.

arduino12 commented 2 years ago

Strange.. Anyway the code thats get compiled is on /src/main.c not the /lib/examples/*, Only different I see is the sdcc toolchain version, maybe try runing pio update and upgrate.. image

vishnumaiea commented 2 years ago

That was a helpful clue. I had updated all PIO packages and also the core. It did not help. Then I uninstalled and re-installed the Intel MCS-51 platform. But that did not work either. What I found is that the default SDCC compiler toolchain used by PIO is v3.8.4. That was causing the issue.

The latest supported version is v4.1.0 as described here on the PIO website - https://registry.platformio.org/tools/platformio/toolchain-sdcc/installation

So I just had to copy the version string platformio/toolchain-sdcc@^1.30901.11242 to the platformio.ini file.

image

PIO installed the new dependencies and the file got compiled successfully.

Processing n76e003 (platform: https://github.com/arduino12/platform-intel_mcs51.git; board: n76e003)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/intel_mcs51/n76e003.html
PLATFORM: Intel MCS-51 (8051) (1.2.3+sha.2d7556b) > Generic N76E003
HARDWARE: N76E003 16MHz, 1KB RAM, 18KB Flash
PACKAGES: 
 - tool-stcgal 1.104.0 (1.4) 
 - toolchain-sdcc 1.40100.12072 (4.1.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <N76E003>
Building in release mode
Compiling .pio\build\n76e003\src\main.rel
Compiling .pio\build\n76e003\lib634\N76E003\Common.rel
Compiling .pio\build\n76e003\lib634\N76E003\Delay.rel
Archiving .pio\build\n76e003\lib634\libN76E003.lib
Indexing .pio\build\n76e003\lib634\libN76E003.lib
Linking .pio\build\n76e003\firmware.hex
Checking size .pio\build\n76e003\firmware.hex
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
Flash: [          ]   3.2% (used 582 bytes from 18432 bytes)
==================================================================== [SUCCESS] Took 3.15 seconds ====================================================================

Terminal will be reused by tasks, press any key to close it.

Thank you for your help, and thank you for making the effort to add NE76E003 to PIO environment 💛

arduino12 commented 2 years ago

Amazing! apparently I did similar version fix but forgot to commit it to my platform-intel_mcs51 fork!🤯 Now it is pushed to my fork - so should work out of the box- if you can also verify it works (without the added .pio platform_packages = platformio/toolchain-sdcc@^1.30901.11242) will be great!

Thanks and have a great time playing with this MCU🤗!

vishnumaiea commented 2 years ago

Sure I'll test that 😀

vishnumaiea commented 2 years ago

Yes, adding a more recent version string to the platform.json of MCS-51 platform works.

arduino12 commented 2 years ago

Great, thanks!