Cannot run same program that can be compiled in Mbed Online Compiler, in Keil Studio

Board: STM NUCLEO-F411RE
Libraries used:
mbed.h
Keypad.h (keypad | Mbed)
TextLCD (TextLCD - TextLCD library for controlling various LCD panel… | Mbed)

Error message:
unknown type name ‘Serial’
too many arguments to function call, expected single argument ‘func’, have 2 arguments
too many arguments to function call, expected single argument ‘func’, have 2 arguments
too many arguments to function call, expected single argument ‘func’, have 2 arguments
too many arguments to function call, expected single argument ‘func’, have 2 arguments
no type named ‘wait’ in ‘rtos::Thread’
compile mbed-os/connectivity/cellular/source/framework/AT/AT_CellularStack.cpp
compile mbed-os/connectivity/cellular/source/framework/common/APN_db.cpp
compile mbed-os/connectivity/cellular/source/framework/AT/AT_ControlPlane_netif.cpp
compile mbed-os/connectivity/cellular/source/framework/AT/AT_CellularNetwork.cpp
compile mbed-os/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp
compile keypad/Keypad.cpp
/src/keypad/Keypad.cpp:3:8: error: unknown type name ‘Serial’
extern Serial PC;
^
/src/keypad/Keypad.cpp:31:30: error: too many arguments to function call, expected single argument ‘func’, have 2 arguments
_rows[0]->rise(this, &Keypad::_cbRow0Rise);
~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~
/extras/mbed-os.lib/drivers/include/drivers/InterruptIn.h:106:10: note: ‘rise’ declared here
void rise(Callback<void()> func);
^
/src/keypad/Keypad.cpp:35:30: error: too many arguments to function call, expected single argument ‘func’, have 2 arguments
_rows[1]->rise(this, &Keypad::_cbRow1Rise);
~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~
/extras/mbed-os.lib/drivers/include/drivers/InterruptIn.h:106:10: note: ‘rise’ declared here
void rise(Callback<void()> func);
^
/src/keypad/Keypad.cpp:39:30: error: too many arguments to function call, expected single argument ‘func’, have 2 arguments
_rows[2]->rise(this, &Keypad::_cbRow2Rise);
~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~
/extras/mbed-os.lib/drivers/include/drivers/InterruptIn.h:106:10: note: ‘rise’ declared here
void rise(Callback<void()> func);
^
/src/keypad/Keypad.cpp:43:30: error: too many arguments to function call, expected single argument ‘func’, have 2 arguments
_rows[3]->rise(this, &Keypad::_cbRow3Rise);
~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~
/extras/mbed-os.lib/drivers/include/drivers/InterruptIn.h:106:10: note: ‘rise’ declared here
void rise(Callback<void()> func);
^
/src/keypad/Keypad.cpp:137:13: error: no type named ‘wait’ in ‘rtos::Thread’
Thread::wait(_debounce);
~~~~~~~~^
6 errors generated.
Internal error.
Build failed
Build failed

I am getting all of these errors in Keil Studio, but when I use the same code and libraries in Mbed Online compiler, no errors. Is there a workaround for this problem?

Hello,

You probably use an old MbedOS version (definitely older than MbedOS6+), that is why you have problem with everything.

MbedOS versions

  • MbedOS 2 - odest from 2010 and marked as deprecate maybe more than 3 years ago
  • MbedOS 5 - First release in 2016 and latest version is MbedOS 5.15.9
  • MbedOS 6 - First release in 2020 and latest version is MbedOS 6.16

KSC supporting whole MbedOS6+, MbedOS 5.12+ and a version of MbedOS 2, but recommended is latest one, the latest is Mbed OS6.16.

When you update MbedOS to latest in Online Compiler you will faced same issue. You need update your code (to be compatible with MbedOS6+) or downgrade MbedOS version in KSC - Arm Keil Studio Cloud User Guide

BR, Jan

1 Like

Hello,

Thank you JohnnyK for your reply. Indeed, Keil Studio provides limited support for Mbed 2, so it is recommended to upgrade to Mbed OS 5 or 6.

I see, that makes sense, so by downgrading the Mbed OS of Keil Studio, there would be no errors as well. However, the problem is the library that I am using is from 2012 and I don’t think it is maintained for the latest Mbed OS. Can you please suggest alternative libraries for the keypad and TextLCD?

Yes, I can and I believe it will be also good for you.
@kenjiArai makes a fork of lates version of this library and he did necesary updates in the library to be compatible with MbedOS6+.

Look to this topic Is there any TextLCD program directly work on mbed studio(mbed-os 6.6 ) - #2 by JohnnyK

BR, Jan

2 Likes