c - Shared variables [RTOS] -


simple background:

running freertos on mcu.

one of features have in project library handles parameters stored in external memories.

basically @ startup, main function calls function reads parameters external memories , stores them inside library, in static variables (not global).

now, have couple of tasks running. of tasks calls function within parameter library read/write from/to parameters.

questions: when tasks calls function read parameter, trying access same variable. right?

it's not each tasks creates own copy of whole library?

if that's not case guess semaphores way achieve goal, , there i'll fine.

two images uploaded: first 1 way assume correct, , second 1 faulty.

correct faulty

ps. no access controller. i'm asking here :)

your assumption correct. must remember still compiling single c program. mcu os part of program , doesn't contain program loader or that, , have 1 main.
means program behave in normal c program, there won't duplicate variables or hidden traps. weird point os capable of switching tasks magic.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -