Closed vshymanskyy closed 3 months ago
I overlooked the "C" linkage. It builds successfully like this:
extern "C" {
#include <dct.h>
}
I also had to add "-I{ameba.sdkpath}/component/common/file_system/dct"
to the compiler.ameba.c.include
in platform.txt
. It would be great if it was included by default.
Didn't test It yet. I need to define a dedicated region / partition in the flash memory.
So yeah, DCT
actually works as a back-end for the Preferences library:
Preferences_Test/Preferences_Test.ino:142:test_bytes:PASS
Preferences_Test/Preferences_Test.ino:144:test_zero_bytes:PASS
Preferences_Test/Preferences_Test.ino:146:test_utf8_key:PASS
Preferences_Test/Preferences_Test.ino:147:test_utf8_value:PASS
Preferences_Test/Preferences_Test.ino:148:test_remove_key:PASS
Preferences_Test/Preferences_Test.ino:149:test_clear_namespace:PASS
So, there are 2 questions left:
"-I{ameba.sdkpath}/component/common/file_system/dct"
needs to be added to compiler.ameba.c.include
in platform.txt
.@vshymanskyy ,
The dct function is default wrapped in lib_dct.a
under /variants/common_libs/
, therefore, to compile dct successfully, you may add in "-I{ameba.sdkpath}/component/common/file_system/dct"
in platform.txt
For the DCT configuration, please refer to our standard sdk example located at ambd_sdk\component\common\example\dct
. (https://github.com/ambiot/ambd_sdk/tree/dev/component/common/example/dct)
Please do let us know if there are any other things that we could assist you with. And is there any chance that you could pull request this feature upon compilation is done? By the way, xidameng has already left the team.
Thank you for your support.
The Device Configuration Table
support was added and pushed to GitHub.
@S10143806H would you consider this:
platform.txt
@S10143806H could you please review these portions of code:
https://github.com/vshymanskyy/Preferences/blob/main/src/Preferences_impl_dct.h#L12-L29
https://github.com/vshymanskyy/Preferences/blob/main/src/Preferences_impl_dct.h#L41-L55
This issue is stale because it has been open for 14 days with no activity.
@M-ichae-l @xidameng let me know if this is something you would consider
@vshymanskyy
Thanks for bring it out. As we have discovered, there is no example for DCT demo at arduino level Arduino_package/hardware/libraries
But there is a lib_dct.a
at compilations process. So as you have provided the Preference. Why not just do the Pull Request, as a submodule of the SDK?
The
Device Configuration Table
support was added and pushed to GitHub. @S10143806H would you consider this:
- Adding the required include path to the
platform.txt
- Adding the Preferneces library to your library package by default? https://github.com/vshymanskyy/Preferences
Hi @vshymanskyy , Sorry for the late reply.
Device Configuration Table
referring to? I could not find any related code in your repo. ThanksAs answered previously, the line including lib_dct.a
have exited in platform.txt
: https://github.com/ambiot/ambd_arduino/blob/8e9512a7ac1372b6cc123127da36324f8d0002a2/Arduino_package/hardware/platform.txt#L83C1-L83C1
Yes, you could go ahead with Pull Request your examples into our SDK upon verification. I have tested your examples but both of them seems could not compile successfully in AmebaD Arduino environment.
Therefore, maybe could you please clarify what are things that I could do to help you with your Pull Request contribution. And we could proceed to review your codes. Thank you.
Device Configuration Table
, as far as I understand. The related parts of the library are highlighted here: https://github.com/ambiot/ambd_arduino/issues/195#issuecomment-1669594923lib_dct.a
is linked, but component/common/file_system/dct
is not included by default: https://github.com/ambiot/ambd_arduino/blob/8e9512a7ac1372b6cc123127da36324f8d0002a2/Arduino_package/hardware/platform.txt#L72Preferences
, but you need to use the latest (unreleased) version from github. The default examples are using Serial.printf
which is not available on Amebad
. We can improve it either by changing the examples or by adding Serial.printf
to your platform (which is fairly easy, but only works if Arduino_STD_PRINTF
is defined).Updated one of the examples so it doesn't rely on Print::printf()
: https://github.com/vshymanskyy/Preferences/blob/main/examples/StartCounter/StartCounter.ino
This issue is stale because it has been open for 14 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.
This issue is stale because it has been open for 14 days with no activity.
will get to it soon
This issue is stale because it has been open for 14 days with no activity.
This issue is stale because it has been open for 14 days with no activity.
still not there;) sorry!
@vshymanskyy Thanks for the patient, I have create a submodule of your repo main branch. #5a4b8b79ede9ec2502da29b34cd89e65749bfad6 You may want to review the update. If any update or debug I will help to merge. However, Please note that there is no early release version for current SDK with your submodule. Once your review is one, I will help to create a early release version SDK.
This issue is stale because it has been open for 14 days with no activity.
I'm alive!
@vshymanskyy
Could you review about the submodule system for the example you have ported?
This issue is stale because it has been open for 14 days with no activity.
@M-ichae-l please elaborate, Didn't get your question
This issue is stale because it has been open for 14 days with no activity.
@M-ichae-l ?
@vshymanskyy
Can you review the submodule here https://github.com/ambiot/ambd_arduino/tree/dev/Arduino_package/hardware/libraries
If there is no further issue, we will add your repo into the SDK by submodule.
This issue is stale because it has been open for 14 days with no activity.
ok, i should be able to verify it during the weekend. sorry for a delay, the project that used it was put on hold, so i need to setup the environment again. this holds back any progress
Looks like everything is correct. Closing the ticket. Thanks for all your help and support!
I need to store some settings in the form of key-value pairs in the NVM (Flash). Overall, I'm trying to get support for Ameba devices for my Preferences library.
One option I found is to use DCT:
However, looks like the DCT library is not linked, I'm getting:
Another option is to use some kind of a File system (I see FATFS, but can it be used on the system flash?).
Also, to store any data in the flash, I need to define a dedicated region / partition in the flash memory. What's the best practice to do that?
@xidameng please advise