# Counting semaphore usage and abrupt halt at ConfigASSERT(pxQueue)

**URL:** <https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539>\
**Category:** Kernel\
**Created:** [July 27, 2022, 4:11am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539 "2022-07-27T04:11:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pra18](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@pra18](https://forums.freertos.org/u/pra18)\
**Post date:** [July 27, 2022, 4:11am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539/1 "2022-07-27T04:11:07Z")

</div>

Hi

We tried porting freeRTOs 10.4 kernel to RH850 closely following the available ports at [freertos.org](http://freertos.org)

We are able to successfully build and debug using GHS IDE but when we migrate to eclipse based GHS environment we encounter an exception at ConfigASSERT(pxQueue). this doesnot happen in GHS IDE but only in eclipse toolchain and in case both binary and counting semaphores are being used.

We are surprised as to what changes things in a toolchain based system.

we tried out the different options such as introducing a delay after tasks are created and putting all source code into a single file and so on but no difference made .

we checked the freeRTOS configuration and found configASSERT is defined to be just a disable interrupts and a infinite loop to hang around. Thinking to try to replace it with a tracelog using sprintf and va\_arg stuff.

Any suggestions please?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [July 27, 2022, 5:20am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539/2 "2022-07-27T05:20:51Z")

</div>

> [@pra18](#):
>
> ConfigASSERT(pxQueue)

This assert means that pxQueue is NULL i.e. the FreeRTOS object (semaphore/queue/mutex) is used before creation.

What is the callstack when you hit the assert? That should provide some hint. Also, do you check return values of FreeRTOS APIs?

---

<div class="post-metadata">

**Author:** ![pra18](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@pra18](https://forums.freertos.org/u/pra18)\
**Post date:** [July 27, 2022, 9:33am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539/3 "2022-07-27T09:33:03Z")

</div>

ok but why it works in the GHS IDE and why not in the eclipse based GHS toolchain?

any anomalies w.r.t toolchain observed before?

I will try to check call stack and get back.

Regards,

---

<div class="post-metadata">

**Author:** ![hs2](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@hs2](https://forums.freertos.org/u/hs2)\
**Post date:** [July 27, 2022, 9:50am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539/4 "2022-07-27T09:50:32Z")

</div>

BTW Is the semaphore handle a global/static variable ?

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [July 27, 2022, 10:46am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539/5 "2022-07-27T10:46:17Z")

</div>

> [@pra18](#):
>
> ok but why it works in the GHS IDE and why not in the eclipse based GHS toolchain?

There could be multiple reasons including different code generated by different compilers. We would be able to find why it works in different IDE once we find the reason of the failure.

---

<div class="post-metadata">

**Author:** ![pra18](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@pra18](https://forums.freertos.org/u/pra18)\
**Post date:** [July 28, 2022, 2:42am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539/6 "2022-07-28T02:42:20Z")

</div>

as you can see in attached file, the semaphore variables are global

---

<div class="post-metadata">

**Author:** ![pra18](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@pra18](https://forums.freertos.org/u/pra18)\
**Post date:** [July 28, 2022, 2:45am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539/7 "2022-07-28T02:45:49Z")

</div>

ok, anyways one project is IDE based and another eclipse based but of the same compiler.

I attached the code we are trying to test.

we also use heap\_4.c as the choice of memory manager.

[test.c](https://forums.freertos.org/uploads/short-url/fuCkPwlAtqpkdfDZ3RNZmIymXpM.c) (2.0 KB)  
[main.c](https://forums.freertos.org/uploads/short-url/q1ijCwsWSVFi7CBpDKyepwh6238.c) (6.4 KB)

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [July 28, 2022, 5:23am UTC](https://forums.freertos.org/t/counting-semaphore-usage-and-abrupt-halt-at-configassert-pxqueue/15539/8 "2022-07-28T05:23:28Z")

</div>

Did you find the callstack when you hit assert?
