Topics

Disabling Multithreading


Raj Gundi
 

Hi Carles,

 

I am trying to build Zephyr to fit in a memory constrained device of 64kB. My device doesn’t require multithreading and hence I disabled multithreading to save on the memory. However, this is throwing me exceptions since I have UART and SPI Flash drivers enabled. It appears the semaphore accesses in those drivers are not “single-thread” aware. Is there anything that can be done to work-around this? Does just “nop”ing it out suffice? Please let me know.

 

Regards,

Raj


Raj Gundi
 

Hi Carles,

 

Guess this mail got buried while you were away. Please help me out here.

 

Regards,

Raj

 

From: devel@... [mailto:devel@...] On Behalf Of Raj Gundi
Sent: Saturday, December 15, 2018 8:24 PM
To: Cufi, Carles <carles.cufi@...>
Cc: devel@...
Subject: [Zephyr-devel] Disabling Multithreading

 

Hi Carles,

 

I am trying to build Zephyr to fit in a memory constrained device of 64kB. My device doesn’t require multithreading and hence I disabled multithreading to save on the memory. However, this is throwing me exceptions since I have UART and SPI Flash drivers enabled. It appears the semaphore accesses in those drivers are not “single-thread” aware. Is there anything that can be done to work-around this? Does just “nop”ing it out suffice? Please let me know.

 

Regards,

Raj


Carles Cufi
 

Hi Raj,

 

The issue with CONFIG_MULTITHREADING is that it was never properly supported. It was added for MCUboot and considered for removal a couple of times, but that never happened because the size difference is still significant enough for many people.

The only option at this point is for you to submit a patch for the drivers you need that disables use of any primitives that require multithreading (semaphores, mutexes, etc) behind a macro, like it’s done here:

https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/flash/soc_flash_nrf.c#L68

 

This might not be trivial for SPI though, depending on how the driver is written.

 

Carles

 

From: devel@... <devel@...> On Behalf Of Raj Gundi
Sent: 03 January 2019 10:38
To: Cufi, Carles <Carles.Cufi@...>
Cc: devel@...
Subject: Re: [Zephyr-devel] Disabling Multithreading

 

Hi Carles,

 

Guess this mail got buried while you were away. Please help me out here.

 

Regards,

Raj

 

From: devel@... [mailto:devel@...] On Behalf Of Raj Gundi
Sent: Saturday, December 15, 2018 8:24 PM
To: Cufi, Carles <carles.cufi@...>
Cc: devel@...
Subject: [Zephyr-devel] Disabling Multithreading

 

Hi Carles,

 

I am trying to build Zephyr to fit in a memory constrained device of 64kB. My device doesn’t require multithreading and hence I disabled multithreading to save on the memory. However, this is throwing me exceptions since I have UART and SPI Flash drivers enabled. It appears the semaphore accesses in those drivers are not “single-thread” aware. Is there anything that can be done to work-around this? Does just “nop”ing it out suffice? Please let me know.

 

Regards,

Raj


Raj Gundi
 

Thanks Carles. This is what I had in my mind too. This is already done for the generic spi flash driver (drivers/flash/spi_nor.c). I’ll hope that’s all that’s required. Thanks again.

 

Regards,

Raj

 

From: Cufi, Carles [mailto:Carles.Cufi@...]
Sent: Thursday, January 3, 2019 4:46 PM
To: Gundi, Rajavardhan <rajavardhan.gundi@...>
Cc: devel@...
Subject: RE: [Zephyr-devel] Disabling Multithreading

 

Hi Raj,

 

The issue with CONFIG_MULTITHREADING is that it was never properly supported. It was added for MCUboot and considered for removal a couple of times, but that never happened because the size difference is still significant enough for many people.

The only option at this point is for you to submit a patch for the drivers you need that disables use of any primitives that require multithreading (semaphores, mutexes, etc) behind a macro, like it’s done here:

https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/flash/soc_flash_nrf.c#L68

 

This might not be trivial for SPI though, depending on how the driver is written.

 

Carles

 

From: devel@... <devel@...> On Behalf Of Raj Gundi
Sent: 03 January 2019 10:38
To: Cufi, Carles <Carles.Cufi@...>
Cc: devel@...
Subject: Re: [Zephyr-devel] Disabling Multithreading

 

Hi Carles,

 

Guess this mail got buried while you were away. Please help me out here.

 

Regards,

Raj

 

From: devel@... [mailto:devel@...] On Behalf Of Raj Gundi
Sent: Saturday, December 15, 2018 8:24 PM
To: Cufi, Carles <carles.cufi@...>
Cc: devel@...
Subject: [Zephyr-devel] Disabling Multithreading

 

Hi Carles,

 

I am trying to build Zephyr to fit in a memory constrained device of 64kB. My device doesn’t require multithreading and hence I disabled multithreading to save on the memory. However, this is throwing me exceptions since I have UART and SPI Flash drivers enabled. It appears the semaphore accesses in those drivers are not “single-thread” aware. Is there anything that can be done to work-around this? Does just “nop”ing it out suffice? Please let me know.

 

Regards,

Raj