FreeRTOS | FreeRTOS port for Arduino Uno

 by   maniacbug C Version: Current License: No License

kandi X-RAY | FreeRTOS Summary

kandi X-RAY | FreeRTOS Summary

FreeRTOS is a C library typically used in Internet of Things (IoT), Arduino applications. FreeRTOS has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

FreeRTOS port for Arduino Uno
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              FreeRTOS has a low active ecosystem.
              It has 41 star(s) with 38 fork(s). There are 15 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 1 have been closed. On average issues are closed in 2158 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of FreeRTOS is current.

            kandi-Quality Quality

              FreeRTOS has no bugs reported.

            kandi-Security Security

              FreeRTOS has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              FreeRTOS does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              FreeRTOS releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of FreeRTOS
            Get all kandi verified functions for this library.

            FreeRTOS Key Features

            No Key Features are available at this moment for FreeRTOS.

            FreeRTOS Examples and Code Snippets

            No Code Snippets are available at this moment for FreeRTOS.

            Community Discussions

            QUESTION

            why "A stack overflow in task iot_thread has been detected" is coming continuously?
            Asked 2021-Jun-14 at 22:09

            I'm working on an aws/amazon-freertos project. In there I found some unusual error "A stack overflow in task iot_thread has been detected".

            Many time I got this error and somehow I managed to remove it by changing the code.

            I just want to know what this error means actually?

            As per what I know, it simply means that the iot_thread ask stack size is not sufficient. So it's getting overflow.

            Is this the only reason why this error comes or can there be another reason for this?

            If yes then where should I increase the stack size of the iot_thread task?

            Full Log:

            ...

            ANSWER

            Answered 2021-Jun-14 at 22:05

            It simply means that the iot_thread ask stack size is not sufficient. [...] Is this the only reason why this error comes or can there be another reason for this?

            Either it is insufficient you your stack usage is excessive (due to recursion error or instantiation of instantiation of large objects or arrays. Either way the cause is the same. Whether it is due insufficient stack or excessive stack usage is a matter of design an intent.

            If yes then where should I increase the stack size of the iot_thread task?

            The stack for a thread is assigned in the task creation function. For a dynamically allocated stack that would be the xTaskCreate() call usStackDepth parameter:

            Source https://stackoverflow.com/questions/67970388

            QUESTION

            How to sync tasks using FreeRTOS library?
            Asked 2021-Jun-04 at 05:16

            I have 5 tasks(function) in 5 different which are running simultaneously. I want to implement like any function start running then other function should not run until the function completes its process. I want to implement using FreeRTOS. Example.

            • foo1.c ->Task1
            • foo2.c ->Task2
            • foo3.c ->Task3
            • foo4.c ->Task4
            • foo5.c ->Task5
            ...

            ANSWER

            Answered 2021-Jun-01 at 08:49

            It sounds like you need a mutex. Each task acquires the mutex when they start running, and release it when they are done. When any of the tasks is running, others are blocked on the mutex.

            Source https://stackoverflow.com/questions/67785236

            QUESTION

            Hard Fault when using strtok()
            Asked 2021-Jun-03 at 06:44

            I know there are a lot of other threads regarding the use of strtok() causing segmentation faults but it seems to be a different issue in my case. I'm using it on a STM32L4 controller and the same code works fine when compiled with an online compiler

            ...

            ANSWER

            Answered 2021-Jun-03 at 06:44

            Since strtok is not thread-safe, in multithreaded programs it is better to use strtok_r if it's available (it's not provided by ISO C but it is by POSIX). You stated in comments that this fixed your crash.

            If you were truly only ever calling strtok from one thread (and that includes the main thread), then I don't think this should have made a difference. So perhaps you were mistaken about which threads call this function, or maybe there is another call to strtok elsewhere in your program. You may want to investigate further.

            Another wild guess might be that something is wrong with the linking or loading of your program, such that strtok's internal static data isn't properly allocated in writable memory. If it ended up in ROM, one could imagine that the internal pointer would be stuck on NULL, and the second call to strtok would dereference it.

            Or, perhaps your library's strtok implementation tries to use thread-local storage, to help alleviate this risk, and maybe there is something wrong with how thread-local storage is set up in your program?

            Source https://stackoverflow.com/questions/67800189

            QUESTION

            Using Binary Semaphore and Mutex Together
            Asked 2021-May-26 at 23:16

            I am new to FreeRTOS and have been reading the FreeRTOS documentation and writing simple code using FreeRTOS on an STM32F767 Nucleo Board. In the simple program that I wrote, I used Binary Semaphores only to signal certain tasks when LPTIM and GPIO interrupts occur through xSemaphoreGiveFromISR(), and to signal a different task to perform certain operations from another task through xSemaphoreGive().

            Suppose that I have an I2C1 peripheral connected to two different equipments:

            • An accelerometer that triggers a GPIO interrupt to the microcontroller whenever an activity/movement occurs. This GPIO interrupt signals the microcontroller that a piece of data inside its Interrupt Event registers must be read so that the next activity/movement event can be signalled again.
            • An equipment that must be read from periodically, which will be triggered through an LPTIM or TIM peripheral

            Can I use a Mutex and a Binary Semaphore in the situation above?

            The Binary Semaphores will indicate to the task that an operation needs to be performed based on the respective interrupts that were triggered, but the Mutex will be shared between those two tasks, where Task1 will be responsible with reading data from the accelerometer, and Task2 will be responsible for reading data from the other equipment. I was thinking that a Mutex will be used since these two operations should never occur together, so that there are no overlapping I2C transactions that happen on the bus that could potentially lock up either of the I2C devices.

            The code would look like the following:

            ...

            ANSWER

            Answered 2021-May-26 at 18:40

            In general, I think your design could work. The semaphores are signals for the two tasks to do work. And the mutex protects the shared I2C resource.

            However, sharing a resource with a mutex can lead to complications. First, your operations tasks are not responsive to new semaphore signals/events while they are waiting for the I2C resource mutex. Second, if the application gets more complex and you add more blocking calls then the design can get into a vicious cycle of blocking, starvation, race conditions, and deadlocks. Your simple design isn't there yet but you're starting down a path.

            As an alternative, consider making a third task responsible for handling all I2C communications. The I2C task will wait for a message (in a queue or mailbox). When a message arrives then the I2C task will perform the associated I2C communication. The operations tasks will wait for the semaphore signal/event like they do now. But rather than waiting for the I2C mutex to become available, now the operations tasks will send/post a message to the I2C task. With this design you don't need a mutex to serialize access to the I2C resource because the I2C task's queue/mailbox does the job of serializing the message communication requests from the other tasks. Also in this new design each task blocks at only one place, which is cleaner and allows the operations tasks to be more responsive to the signals/events.

            Source https://stackoverflow.com/questions/67697518

            QUESTION

            FreeRTOS Systick Handler
            Asked 2021-May-24 at 18:19

            I'm studying the FreeRTOS scheduler (port.c) and have a question about Systick handler. I understand xPortSysTickHandler() is supposed to be called at RTOS ticks, but I don't see where it gets specified by saying xPortSysTickHandler() is the Systick timer interrupt callback function.

            Especially, I didn't see that in vPortSetupTimerInterrupt(), which seems a bit strange to me since this function does configure, such as load register value, of the timer.

            Does it gets specified as the callback somewhere else? Or is there something I'm missing?

            Thanks!

            ...

            ANSWER

            Answered 2021-May-24 at 18:19

            It is installed directly into the interrupt vector table. If the vector table uses CMSIS names for the handlers then you can map the CMSIS name to the name of the FreeRTOS systick handler in FreeRTOSConfig.h, as per the FAQ - see the red "special note to ARM Cortex-M users" here: https://www.freertos.org/FAQHelp.html

            Source https://stackoverflow.com/questions/67646586

            QUESTION

            Freertos and the necessity of uart transmit interrupt
            Asked 2021-May-24 at 09:59

            For uart reception, it's pretty obvious to me what can go wrong in case of 'blocking receive' over uart. Even in freertos with a dedicated task to read from uart, context / task switching could result in missing bytes that were received in the uart peripheral.

            But for transmission I am not really sure if there is a need for interrupt based approach. I transmit from a task, and in my design it's no problem if that task is blocked for a short while. (it also blocks/sleeps on mutexes e.g).

            Is there another strong argument to use use uart transmit in interrupt mode? I am not risking anything wrt loss of data, right?

            In my case I use an stm32, but I guess the type of mcu is not really relevant here.

            ...

            ANSWER

            Answered 2021-May-24 at 09:59

            Let's focus on TX only and assume that we don't use interrupts and handle all the transmission with the tools provided by the RTOS.

            µC UART hardware generally have a transmit shift register (TSR) and some kind of data register (DR). The software loads the DR, and if the TSR is empty, DR is instantly transferred into TSR and TX begins. The software is free to load another byte into DR, and the hardware loads the new byte from DR to TSR whenever the TX (shift-out) of the previous byte finishes. Hardware provides status bits for querying the status of DR & TSR. This way, the software can using polling method and still achieve continuous transmission with no gaps between the bytes.

            I'm not sure if the hardware configuration I described above holds for every µC. I have experience with 8 & 16-bit PICs and STM32 F0, F1, F4 series. They are all similar. UART hardware doesn't provide additional hardware buffers.

            Now, back to RTOS... Obviously, your TX task needs to be polling UART status bits. If we assume that UART baud rate is 115200 (which is a common value), you waste ~90 µs of polling for each byte. The general rule of RTOS is that if you are waiting for something to happen, your task needs to be blocked so other tasks can run. But block on what? What will tell you when to unblock? For this you need interrupts. Your task blocks on task notification, (ulTaskNotifyTake()), and the interrupt gives the notification using xTaskNotifyGive().

            So, I can't imagine any other way without using interrupts. But, the method mentioned above isn't good either. It makes no sense to block - unblock with each byte.

            There are 2 possible solutions:

            1. Move TX handling completely to interrupt handler (ISR), and notify the task when TX is completed.
            2. Use DMA instead! Almost all modern 32-bit µCs have DMA support. DMA generates a single interrupt when the TX is completed. You can notify the task from the DMA transfer complete interrupt.

            On this answer I've focused on TX, but using DMA is the proper way of handling reception (RX) too.

            Source https://stackoverflow.com/questions/67668455

            QUESTION

            ESP-IDF deep_sleep and FreeRTOS tasks
            Asked 2021-May-10 at 15:07

            I work on project where I use FreeRTOS tasks and I would like to go into deep_sleep. Is there anything that I should do before going into the deep_sleep ? Or after wake up, RTOS scheduler works as nothing happen ?

            ...

            ANSWER

            Answered 2021-May-10 at 15:07

            There's no easy way to mix freeRTOS and deep_sleep mode. During deep sleep the CPU is powered down and its context is lost, yet the RTC memory can be retained. As all SRAM's content is lost, there's no easy backup-restore we can do here to safely restore everything after coming out from deep sleep.

            But what you can do is to bring everything down to a safe state before entering deep-sleep, you can signal all your tasks to finish what they're doing and exit, and then take some advantage of ESP32's relatively low wake-up latency. It is a very unpleasant inconvenient for a Wi-Fi connected device, but more or less acceptable for BLE devices that will wake up and send a beacon once in a few seconds.

            You would also want to fine-tune the second stage bootloader's configuration by enabling the CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP option so waking-up from deep-sleep would be faster than booting from a cold reset.

            Source https://stackoverflow.com/questions/67367391

            QUESTION

            Send an struct array across a FREERTOS queue
            Asked 2021-May-09 at 22:05

            I am starting with ESP32 and FREERTOS, and I am having problems sending an Struct array across a queue. I have already sent another kind of variables but never an array of Structs and I am getting an exception.

            The sender and the receiver are in different source files and I am starting to thing that maybe is the problem (or at least part of the problem).

            My simplified code looks like this:

            common.h

            ...

            ANSWER

            Answered 2021-May-08 at 10:08

            Firstly it's not a good idea to create the queue in the global scope like you do. A global queue handle is OK. But run xQueueCreate() in the same function that creates task1 and task2 (queue must be created before the tasks), something like this:

            Source https://stackoverflow.com/questions/67441417

            QUESTION

            Using Queue of string in FreeRTOS
            Asked 2021-May-09 at 18:56

            I am using Ardunio/ESP32 and I am very new to FreeRTOS. I want to have a task that is solely responsible for printing text on serial port and other tasks can push messages. So, I decided to use a Queue of char arrays (or std::string) with 10 item capacity. But I am not sure how the queue storage allocation works for elements with different lengths!

            Can you enlighten me on how I should create and consume the queue and what consideration I should take into account?

            ...

            ANSWER

            Answered 2021-May-01 at 19:54

            TL;DR: create a Queue of pointers to std::string and handle new/delete on either side. Make sure both producer and consumer are using a shared memory space.

            The problem with using std::string in a "raw" memory API like FreeRTOS Queue isn't actually an issue with the size of the object. In fact the std::string object size is fixed, regardless of the size of the character array stored by the object. Don't believe me? Try compiling and running this simple program on your own machine:

            Source https://stackoverflow.com/questions/67346516

            QUESTION

            How to run FreeRTOS on TM4C129EXL?
            Asked 2021-Apr-30 at 14:14

            I am working on a C project for the university where a CoAP server is to be hosted on a TM4C129EXL. It is particularly important to choose a FreeRTOS operating system. Unfortunately, I had to learn that Texas Instruments has stopped supporting FreeRTOS. There are no options for me to switch to another operating system. It is for this reason that I turn to you.

            I'm looking for a sample program in which Free RTOS is executed on a TM4C129EXL board. In the best case, I would be happy about a Code Composer Studio Project, as this is the IDE we work with from the university.

            If you do not have any sample code available, I would be happy to receive any other information regarding FreeRTOS and CoAP of course with reference to the TM4C129EXL.

            ...

            ANSWER

            Answered 2021-Apr-30 at 14:14

            You did not specify if you had any requirements in terms of FreeRTOS version, but you can either:

            • use the demo provided in file SW-EK-TM4C1294XL-2.1.4.178.exe available on TI WEB site as is - you will find it in directory examples\boards\ek-tm4c1294xl-boostxl-senshub\senshub_iot
            • use this example as a basis to use a more recent version of FreeRTOS: you just would have to replace FreeRTOS source code by the most recent one, and maybe to modify some code in the demo: some function names/signatures may have changed across major versions.

            The procedure hereafter describes step by step how to create a minimalist FreeRTOS program with Code Composer Studio 10.3.0 and FreeRTOS v202104.00 in a Windows 10 environment using the second approach. You may have to adjust the drive letter to you specific setup, I am using D: for the purpose of this example..

            • Download Code Composer Studio 10.3.0, FreeRTOS v202104.00 and SW-EK-TM4C1294XL-2.1.4.178.exe.

            • Install Code Composer Studio with support for the Tiva-C MCU familly. When prompted for a workspace name, specify D:\ti\workspace_v10.

            • Unzip FreeRTOSv202104.00.zipinto D:\.

            • Unzip SW-EK-TM4C1294XL-2.1.4.178.exe into D:\SW-EK-TM4C1294XL-2.1.4.178.

            • Launch CCS

            • Use the menu item File/New/CCS Project, and create an 'Empty Project (with main.c).

            []

            • Click on the Finishbutton.
            • Create the following directories:
              D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\driverlib
              D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\inc
              D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel
              D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\include
              D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\GCC
              D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\GCC\ARM_CM4F
              D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\MemMang
            • Copy D:\SW-EK-TM4C1294XL-2.1.4.178\examples\boards\ek-tm4c1294xl-boostxl-senshub\senshub_iot\FreeRTOSConfig.h into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS
            • Copy all .h files from D:\SW-EK-TM4C1294XL-2.1.4.178\driverlib into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\driverlib.
            • Copy D:\SW-EK-TM4C1294XL-2.1.4.178\driverlib\gcc\libdriver.a into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\driverlib.
            • Copy all .hfiles from D:\SW-EK-TM4C1294XL-2.1.4.178\inc into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\inc.
            • Copy all files present in D:\FreeRTOSv202104.00\FreeRTOS\Source\include into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\include.
            • Copy all .cfiles present in D:\FreeRTOSv202104.00\FreeRTOS\Source into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel.
            • Copy all file present in D:\FreeRTOSv202104.00\FreeRTOS\Source\portable\GCC\ARM_CM4F into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\GCC\ARM_CM4F
            • Copy D:\FreeRTOSv202104.00\FreeRTOS\Source\portable\MemMang\heap_4.c into D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\FreeRTOS-Kernel\portable\MemMang.
            • Edit D:\ti\workspace_v10\TM4C129EXL-FreeRTOS\main.c, and replace its content by:

            Source https://stackoverflow.com/questions/67229825

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install FreeRTOS

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/maniacbug/FreeRTOS.git

          • CLI

            gh repo clone maniacbug/FreeRTOS

          • sshUrl

            git@github.com:maniacbug/FreeRTOS.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link