Hi Giovanni,
I've added by analogue as "Messages" and "Pools" the "MailQueue" abstraction into the cmsis_os layer. Without MailQueue abstraction, "cmsis" was not fully compatible with the standard.
Also, I've fixed problem with returning incorrect event in GetMessage.
CMSIS API osMessageGet doesn't initialise local variable "osEvent event" and it causes a problem on AVR Architecture where chMBFetchI function filling by address only 16-bit (msg_t) instead 32 bit that variable "event.value.v" has. That causes that we have in most significant bytes of 32-bit variable "event.value.v" garbage from the stack.
If you are interesting, you can find a patch in the attachment.
If you will have any questions I will glad to answer them.
Thanks.
cmsis_os add MailQueue
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: cmsis_os add MailQueue
Hi,
I am interested, our CMSIS wrapper has not seen much use so it has not been touched for a while.
Does a test suite exist for validating a CMSIS RTOS implementation?
GIovanni
I am interested, our CMSIS wrapper has not seen much use so it has not been touched for a while.
Does a test suite exist for validating a CMSIS RTOS implementation?
GIovanni
-
- Posts: 21
- Joined: Fri Apr 08, 2016 4:33 pm
- Location: Ukraine Lviv
- Has thanked: 2 times
- Been thanked: 3 times
- Contact:
Re: cmsis_os add MailQueue
Hi,
In the repository, I've found only one project that uses a cmsis_os API. It is "os\demos\STM32\CMSIS-STM32F407-DISCOVERY\main.c" and it is very simple uses osThreadCreate and osDelay APIs.
I will try to write some test suite for this file. When it will be ready, I will provide the patch in this thread.
Thanks
In the repository, I've found only one project that uses a cmsis_os API. It is "os\demos\STM32\CMSIS-STM32F407-DISCOVERY\main.c" and it is very simple uses osThreadCreate and osDelay APIs.
I will try to write some test suite for this file. When it will be ready, I will provide the patch in this thread.
Thanks
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: cmsis_os add MailQueue
Hi,
I gave this a try but met some problems,
1) There are warning while compiling.
2) No documentation tags.
3) Tt should use Object FIFOs abstraction instead of mailbox and pools directly (which do the same thing).
4) osMailQId is both the name of a structure and the type of a pointer and you are allocating it as variable data into a const definition structure.
5) Structures and unions should be initialized this way:
Except for this looks good overall. I am trying to address the above points.
Giovanni
I gave this a try but met some problems,
1) There are warning while compiling.
2) No documentation tags.
3) Tt should use Object FIFOs abstraction instead of mailbox and pools directly (which do the same thing).
4) osMailQId is both the name of a structure and the type of a pointer and you are allocating it as variable data into a const definition structure.
5) Structures and unions should be initialized this way:
Code: Select all
osEvent event = {
.status = osErrorOS,
.value = {
.v = 0U
},
.def = {
.mail_id = NULL
}
};
Except for this looks good overall. I am trying to address the above points.
Giovanni
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: cmsis_os add MailQueue
I committed a modified patch:
1) Queues are now Object FIFOs, which is exactly what you did but simplifies the code a little bit.
2) Fixed some warning.
3) Fixed event initializers.
Could you try my changes? if everything is OK I will proceed with other points (documentation etc).
Giovanni
1) Queues are now Object FIFOs, which is exactly what you did but simplifies the code a little bit.
2) Fixed some warning.
3) Fixed event initializers.
Could you try my changes? if everything is OK I will proceed with other points (documentation etc).
Giovanni
-
- Posts: 21
- Joined: Fri Apr 08, 2016 4:33 pm
- Location: Ukraine Lviv
- Has thanked: 2 times
- Been thanked: 3 times
- Contact:
Re: cmsis_os add MailQueue
Hi Giovanni,
I appreciate for your work. I will check your changes. Sorry for not answering for a long time.
Thanks.
I appreciate for your work. I will check your changes. Sorry for not answering for a long time.
Thanks.
-
- Posts: 21
- Joined: Fri Apr 08, 2016 4:33 pm
- Location: Ukraine Lviv
- Has thanked: 2 times
- Been thanked: 3 times
- Contact:
Re: cmsis_os add MailQueue
Hi Giovanni,
I have updated files and validated them with Keil Validations scripts. Files you can find in attachment.
Only one case from TC_MailParam scenario was skipped.
uint32_t val = 0;
ASSERT_TRUE (osMailFree (MailQ_Id, &val) == osErrorValue);
I didn't find how to check that return for freeing address was previously allocated from the chFIFO pool. I can add to the osMailQId additional meta information to track that. But maybe you can suggest a method to check that address was got from the chFIFO using the internals of chFIFO implementation.
The report:
CMSIS-RTOS Test Suite Apr 25 2020 20:13:35
TEST 01: TC_MailAlloc PASSED
TEST 02: TC_MailCAlloc PASSED
TEST 03: TC_MailToThread PASSED
TEST 04: TC_MailFromThread PASSED
TEST 05: TC_MailTimeout PASSED
TEST 06: TC_MailCheckTimeout PASSED
TEST 07: TC_MailParam PASSED
TEST 08: TC_MailInterrupts PASSED
TEST 09: TC_MailFromThreadToISR PASSED
TEST 10: TC_MailFromISRToThread PASSED
Test Summary: 10 Tests, 10 Executed, 10 Passed, 0 Failed, 0 Warnings.
Test Result: PASSED
Thanks.
I have updated files and validated them with Keil Validations scripts. Files you can find in attachment.
Only one case from TC_MailParam scenario was skipped.
uint32_t val = 0;
ASSERT_TRUE (osMailFree (MailQ_Id, &val) == osErrorValue);
I didn't find how to check that return for freeing address was previously allocated from the chFIFO pool. I can add to the osMailQId additional meta information to track that. But maybe you can suggest a method to check that address was got from the chFIFO using the internals of chFIFO implementation.
The report:
CMSIS-RTOS Test Suite Apr 25 2020 20:13:35
TEST 01: TC_MailAlloc PASSED
TEST 02: TC_MailCAlloc PASSED
TEST 03: TC_MailToThread PASSED
TEST 04: TC_MailFromThread PASSED
TEST 05: TC_MailTimeout PASSED
TEST 06: TC_MailCheckTimeout PASSED
TEST 07: TC_MailParam PASSED
TEST 08: TC_MailInterrupts PASSED
TEST 09: TC_MailFromThreadToISR PASSED
TEST 10: TC_MailFromISRToThread PASSED
Test Summary: 10 Tests, 10 Executed, 10 Passed, 0 Failed, 0 Warnings.
Test Result: PASSED
Thanks.
- Attachments
-
- cmsis_os.zip
- (8.16 KiB) Downloaded 158 times
-
- Posts: 21
- Joined: Fri Apr 08, 2016 4:33 pm
- Location: Ukraine Lviv
- Has thanked: 2 times
- Been thanked: 3 times
- Contact:
Re: cmsis_os add MailQueue
Hi Giovanni,
I also have updated Timers and validated them.
Patch for current master in the attachement.
Thanks.
I also have updated Timers and validated them.
Patch for current master in the attachement.
CMSIS-RTOS Test Suite Apr 25 2020 23:27:14
TEST 01: TC_TimerOneShot PASSED
TEST 02: TC_TimerPeriodic PASSED
TEST 03: TC_TimerParam PASSED
TEST 04: TC_TimerInterrupts PASSED
Test Summary: 4 Tests, 4 Executed, 4 Passed, 0 Failed, 0 Warnings.
Test Result: PASSED
Thanks.
- Attachments
-
- TimersPath.zip
- (694 Bytes) Downloaded 151 times
-
- Posts: 21
- Joined: Fri Apr 08, 2016 4:33 pm
- Location: Ukraine Lviv
- Has thanked: 2 times
- Been thanked: 3 times
- Contact:
Re: cmsis_os add MailQueue
Hi Giovanni,
In the attachment, you can find a patch for Pools API on the master branch.
Here I have the same problem with a test that checks that address that we are returning into the pool, that it was gotten from this pool.
uint32_t val = 0;
ASSERT_TRUE (osPoolFree (MemPool_Id, &val) == osErrorValue);
For now, I skipped this test step.
In the attachment, you can find a patch for Pools API on the master branch.
Here I have the same problem with a test that checks that address that we are returning into the pool, that it was gotten from this pool.
uint32_t val = 0;
ASSERT_TRUE (osPoolFree (MemPool_Id, &val) == osErrorValue);
For now, I skipped this test step.
CMSIS-RTOS Test Suite Apr 26 2020 12:24:22
TEST 01: TC_MemPoolAllocAndFree PASSED
TEST 02: TC_MemPoolAllocAndFreeComb PASSED
TEST 03: TC_MemPoolZeroInit PASSED
TEST 04: TC_MemPoolParam PASSED
TEST 05: TC_MemPoolInterrupts PASSED
Test Summary: 5 Tests, 5 Executed, 5 Passed, 0 Failed, 0 Warnings.
Test Result: PASSED
- Attachments
-
- PoolsPath.zip
- (682 Bytes) Downloaded 143 times
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: cmsis_os add MailQueue
Hi,
Please post files not patches. Those are all failing because paths and line endings differences.
Giovanni
Please post files not patches. Those are all failing because paths and line endings differences.
Giovanni
Return to “Small Change Requests”
Who is online
Users browsing this forum: No registered users and 32 guests