ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Пятница
19 апреля
1011495 Топик полностью
BlackMorda, мудак (11.06.2020 11:19, просмотров: 911) ответил Xитpый Kитaeц на Вы смешали бульдога с носорогом и не хотите это понять :) Mutex - это не из ИАРа (Там его нет и быть не может), это совсем из другого места :). Чтобы изобрести rtos нужен хороший план и много времени. Берите готовую: ucos, protothreaads, freertos, mainloop, rtems :)), выпиливайте из них ненужное или наоборот.
IAR C/C++ Development Guide. Compiling and Linking for STMicroelectronics’ STM8 Microcontroller Family 

https://www.compel.ru/wordpress/wp-content/uploads/2012/10/EWSTM8_DevelopmentGuide.pdf

In the following example, a binary semaphore - that is, a mutex - is implemented using one static variable and two monitor functions. A monitor function works like a critical region, that is no interrupt can occur and the process itself cannot be swapped out. A semaphore can be locked by one process, and is used for preventing processes from simultaneously using resources that can only be used by one process at a time, for example a USART. The __monitor keyword assures that the lock operation is atomic; in other words it cannot be interrupted.