Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_rtl_sprintf: format not support! #134

Closed
bkrajendra opened this issue Oct 15, 2022 · 2 comments
Closed

_rtl_sprintf: format not support! #134

bkrajendra opened this issue Oct 15, 2022 · 2 comments

Comments

@bkrajendra
Copy link

I am using a simple sprintf in my code.

sprintf(path, "/input/post?node=%s&json={humidity:'%2.1f',temp: '%2.1f'}', 'apikey':%s}", cid, h, t, api_key);

what could be wrong here.?

@xidameng
Copy link
Contributor

Hi @bkrajendra ,

Thanks for your feedback, Ameba D by default uses custom sprintf implementation in its ROM, thus it doesn't support all format specifier such as %lf etc. This is so to save memory and prevent malicious attacks targetting RAM.

However, this SDK also supports standard lib implementation, we will add a easy-to-use option in the Arduino IDE drop down menu later, but for now, you can follow my steps below to fix your issue,

  1. Locate the Arduino.h file on your PC, for my case, the path looks like this if you are using the Latest Version,

%USERPROFILE%\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.4\cores\ambd

  1. Uncomment the macro Arduino_STD_PRINTF and add another macro

Nagivate to line 30, and uncomment this line, then add #define STD_PRINTF in the line above

xidameng added a commit to xidameng/ambd_arduino that referenced this issue Oct 17, 2022
- Fix "formar not supported!" issue when using Ameba standard lib functions
- Add an option to the IDE drop down menu to switch between Ameba and
  gcc standard lib function implementation
xidameng added a commit to xidameng/ambd_arduino that referenced this issue Oct 17, 2022
- Fix "formar not supported!" issue when using Ameba standard lib functions
- Add an option to the IDE drop down menu to switch between Ameba and
  gcc standard lib function implementation
ambiot pushed a commit that referenced this issue Oct 17, 2022
- Fix "formar not supported!" issue when using Ameba standard lib functions
- Add an option to the IDE drop down menu to switch between Ameba and
  gcc standard lib function implementation
@xidameng
Copy link
Contributor

xidameng commented Oct 17, 2022

This issue is fixed in PR #136 , proceed to close the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants