FreeRTOS 10 & POSIX

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
bobspam@free.fr
Offline
Last seen: 1 year 9 months ago
Joined: 2018-06-20 08:07
FreeRTOS 10 & POSIX

Hello

I am willing to use the posix lib from amazon-freertos located at :
https://github.com/aws/amazon-freertos
It is packaged with freertos 10 while the DA1468x SDK is packaged with freertos 8.

Are there any roadmap available indicating if / when upgrade is planned ?

Thank you in advance

ST

Keywords: 
Device: 
PM_Dialog
Offline
Last seen: 9 months 1 week ago
Staff
Joined: 2018-02-08 11:03
Hi bobspam@free.fr,

Hi bobspam@free.fr,

We are working on FreeRTOS 10 support in the DA1468x SDK. The expected time line for release is Q2 2019.

Thanks, PM_Dialog

bobspam@free.fr
Offline
Last seen: 1 year 9 months ago
Joined: 2018-06-20 08:07
Hello

Hello

Thank you for your answer. It is good to know but I can not wait 6 month.

I replaced most of FreeRTOS 8 files by 10 ones. Compilation of the new version together with POSIX lib from amazon is finally ok if:
- ARM_C0/port.c and portmacro.h are not updated. (new version implements Thumb-2 that end-up to some compilation errors)
- activating configSUPPORT_STATIC_ALLOCATION. The following statements must be included in main.c :
https://www.freertos.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
- #define configIDLE_TASK_STACK_SIZE 60 (the figure 60 has been reported to be used in some other Cortex-M0 projects)

I ended-up with
Building target: FreeRTOS_Demo.elf
Invoking: Cross ARM C Linker
[...]
c:/program files (x86)/diasemi/smartsnippetsstudio/gcc/4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: FreeRTOS_Demo.elf section `.bss' will not fit in region `RAM'
c:/program files (x86)/diasemi/smartsnippetsstudio/gcc/4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: region RAM overflowed with stack
c:/program files (x86)/diasemi/smartsnippetsstudio/gcc/4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 864 bytes

Meaning that I need to clean-up the SDK by removing unused features...

To be continued

PM_Dialog
Offline
Last seen: 9 months 1 week ago
Staff
Joined: 2018-02-08 11:03
Hi bobspam@free.fr,

Hi bobspam@free.fr,

As it has already been mentioned in the precious post, the is not currently supported. Although, glad that you replaced most of FreeRTOS 8 files by 10 ones and thanks for the indication.

Thanks, PM_Dialog

bobspam@free.fr
Offline
Last seen: 1 year 9 months ago
Joined: 2018-06-20 08:07
Hi PM_Dialog,

Hi PM_Dialog,

A few days of work later

- DA14683 SDK can be compiled successfully with arm-none-eabi-gcc version 15:6.3.1+svn253039-1build1 delivered in standard with Ubuntu LTS 18.0.4. Default configuration of the compiler is broken but homemade Makefile with nostdlib activated on both compilation and linking finally works.
- The following sequence must be linked manually : crt0.o crti.o crtbegin.o [-L paths] [user objects] [gcc libs] [C libs] [gcc libs] crtend.o crtn.o ( thanks to Gentoo forum : https://dev.gentoo.org/~vapier/crt.txt ). This sequence does not seem to be properly set in Eclipse environment. To be checked; because it seems that there are some system headers used and redefinition happens when trying to use amazon POSIX libs.

- FreeRTOS files from amazon repository can be used "as is" to replace the V8 delivered in the SDK
- V8 ARM_C0/port.c and portmacro.h must still be used because of implementation of DA1468x low level features
- #define configSUPPORT_STATIC_ALLOCATION 1 (with functions added to main.c. see previously)
- #define configUSE_POSIX_ERRNO 1 must be added in FreeRTOSConfig.h
- some relative path to some headers files are to be cleaned to avoid usage of V8 headers
- remove PRIVILEDGE_DATA redefinition in V10 mpu_wrappers.h
- use an empty FreeRTOS_POSIX_portable.h from other targets

- POSIX files from amazon repository can be added to the project and compiled as is.

freertos_retarget works fine on USB dev kit using this configuration.

I still need to check POSIX implementation of amazon before going on but all this sounds mature and ready to be used so you should consider to move forward and bring it into the SDK. POSIX libs is a very efficient way to prototype software under linux and to bring it down to embedded systems.

To be continued...

bobspam@free.fr
Offline
Last seen: 1 year 9 months ago
Joined: 2018-06-20 08:07
Hello

Hello

I do confirm that there is no major difference between FreeRTOS 8 embedded in the SDK and FreeRTOS 10 maintained by Amazon.

Porting ARM_C0/port.c and portmacro.h is straightforward. Source code is identical with one exception at the beginning of assembly sections where FreeRTOS 10 enable the usage of Thumb2.

I do confirm that it works easily and that POSIX adaptation layer is also working.
pthread_create is OK.

Heap consumption is higher so memory map must be checked, "stack overflow" and "malloc failed" hooks must be activated to get proper debug.

Amazon version is missing pthread_cancel function to properly execute service destructors. This should not be critical in systems not designed to be shutdown.

Best Regards

PM_Dialog
Offline
Last seen: 9 months 1 week ago
Staff
Joined: 2018-02-08 11:03
Hi bobspam@free.fr,

Hi bobspam@free.fr,

Thanks for your indications.

Thanks, PM_Dialog

bobspam@free.fr
Offline
Last seen: 1 year 9 months ago
Joined: 2018-06-20 08:07
Hello,

Hello,

Amazon implementation of pthread uses a very low level of stack memory for a created thread.
pthread_attr_t must be used to get proper behavior of the overall system by manually setting stack size of each thread.

I also do confirm that mutex and message queue works too.
Condition variables and semaphore are still to be tested on my side.

The Amazon software is delivered with a lot of other nice stuff
- MQTT
- PKCS11
- TLS

Next version of DA1468x might be 256k of internal memory :-)

Thanks