Skip to content

Update to Freertos 10.3.1 Add CortexM33 support #48

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

Merged
merged 8 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ CMSIS-RTOSv2.

* MPU: not supported.
* No CMSIS-RTOSv2 support provided. It is provided as example.
* On Cortex-M0 and Cortex-M0+, all IT are disabled between xTaskCreate() and vTaskStartScheduler().
So it is not possible to use IT inbetween, like Serial.print() ...
This is the reason why, in example "frLiyLayland", between xTaskCreate() and vTaskStartScheduler(),
we use direct printf(), which will access directly USART without interrupt

## Files & Configuration

Expand Down Expand Up @@ -105,3 +109,14 @@ CMSIS-RTOSv2.
| [P-Nucleo-WB55RG](https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html) | PASSED | PASSED | FAILED | PASSED | PASSED |

\* PASSED with `configUSE_NEWLIB_REENTRANT` set to 0 due to small RAM.

### STM32FreeRTOS v10.3.1
| Board | AnalogRead_DigitalRead | frBlinkPrint | frLiuLayland | frBlink (CMSIS-RTOSv2) | Blinky (CMSIS-RTOSv2) |
| --- | :---: | :---: | :---: | :---: | :---: |
| [Nucleo F091RC (Cortex-M0)](http://www.st.com/en/evaluation-tools/nucleo-f091rc.html) | PASSED | PASSED | PASSED | PASSED | PASSED |
| [Nucleo G071RB (Cortex-M0+)](http://www.st.com/en/evaluation-tools/nucleo-g071rb.html) | PASSED | PASSED | PASSED | PASSED | PASSED |
| [Nucleo F103RB (Cortex-M3)](http://www.st.com/en/evaluation-tools/nucleo-f103rb.html) | PASSED | PASSED | PASSED | PASSED | PASSED |
| [Nucleo L476RG (Cortex-M4)](http://www.st.com/en/evaluation-tools/nucleo-l476rg.html) | PASSED | PASSED | PASSED | PASSED | PASSED |
| [Nucleo H743ZI (Cortex-M7)](https://www.st.com/en/evaluation-tools/nucleo-h743zi.html) | PASSED | PASSED | PASSED | PASSED | PASSED |
| [Nucleo L552ZE-Q (Cortex-M33)](https://www.st.com/en/evaluation-tools/nucleo-l552ze-q.html) | PASSED | PASSED | PASSED | PASSED | PASSED |
| [Nucleo U575ZI-Q (Cortex-M33)](https://www.st.com/en/evaluation-tools/nucleo-u575zi-q.html) | PASSED | PASSED | PASSED | PASSED | PASSED |
38 changes: 21 additions & 17 deletions examples/frLiuLayland/frLiuLayland.ino
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,28 @@ void calibrate() {
uint32_t t = micros();
burnCPU(1000);
t = micros() - t;
cal = (TICK_USEC*1000*cal)/t;
cal = (TICK_USEC * 1000 * cal) / t;
}
//------------------------------------------------------------------------------
// print helpers
// On Cortex-M0 and Cortex-M0+, all IT are disabled between xTaskCreate() and vTaskStartScheduler().
// So it is not possible to use IT inbetween, like Serial.print() ...
// This is the reason why, in example "frLiyLayland", between xTaskCreate() and vTaskStartScheduler(),
// we use direct printf(), which will access directly USART without interrupt
void printTask(task_t* task) {
Serial.print(task->period);
Serial.write(',');
Serial.print(task->cpu);
Serial.write(',');
Serial.println(task->priority);
printf("%u, ", task->period);
printf("%u, ", task->cpu);
printf("%u\r\n", task->priority);
}
void done(const char* msg, task_t* task, TickType_t now) {
vTaskSuspendAll();
Serial.println(msg);
Serial.print("Tick: ");
Serial.println(now);
Serial.print("Task: ");
Serial.flush();
printTask(task);
while(1);
while (1);
}
//------------------------------------------------------------------------------
// start tasks at 1000 ticks
Expand Down Expand Up @@ -120,7 +123,7 @@ void setup() {
portBASE_TYPE s; // task create status

Serial.begin(9600);
while(!Serial) {}
while (!Serial) {}
Serial.println("Rate Monotonic Scheduling Examples.");
Serial.println("Cases 1 and 3 should fail");
Serial.println("Cases 2 and 4 should succeed");
Expand Down Expand Up @@ -149,28 +152,29 @@ void setup() {

uint32_t t = micros();
burnCPU(1000);
Serial.println(micros() -t);
Serial.println(micros() - t);
Serial.println("Starting tasks - period and CPU in ticks");
Serial.println("Period,CPU,Priority");
Serial.flush();
for (int i = 0; i < n; i++) {
printTask(&tasks[i]);
cpuUse += tasks[i].cpu/(float)tasks[i].period;
cpuUse += tasks[i].cpu / (float)tasks[i].period;

s = xTaskCreate(task, NULL, 200, (void*)&tasks[i], tasks[i].priority, NULL);
if (s != pdPASS) {
Serial.println("task create failed");
while(1);
printf("task create failed\n");
while (1);
}
}
Serial.print("CPU use %: ");
Serial.println(cpuUse*100);
Serial.print("Liu and Layland bound %: ");
Serial.println(LiuLayland[n - 1]);

char CPU[10];
char bound[10];
printf("CPU use %%: %s\r\n", dtostrf(cpuUse*100, 6, 2, CPU));
printf("Liu and Layland bound %%: %s\r\n", dtostrf(LiuLayland[n - 1], 6, 2, bound));
// start tasks
vTaskStartScheduler();
Serial.println("Scheduler failed");
while(1);
while (1);
}
//------------------------------------------------------------------------------
// WARNING idle loop has a very small stack (configMINIMAL_STACK_SIZE)
Expand Down
Loading