メインコンテンツまでスキップ

Os Configuration

What You Will Do​

Os decides what runs and when. In this chapter you create its containers by hand in the ECU Configuration editor: the settings of the operating system as a whole, the application mode and resource that EcuM names, one counter, four tasks and three alarms that activate the periodic tasks.

Before You Begin​

  • Start after finishing PRTE Setup.
  • Click Configuration under MODULE to open the ECU Configuration editor.
  • + at the right end of a row in the CONFIGURATION tree adds a container of that definition, with its default values, and selects it. Change only the values in the table. Type a number and press Tab; pick a reference from its list.
  • A bold name in the Container column is not the name + gives. Type it in Name in the panel and press Tab.
Container+ onValues
OsOSOsOSOsStatus EXTENDED, OsStackMonitoring TRUE, OsUseGetServiceId TRUE, OsUseParameterAccess TRUE
OsOS/OsHooksOsHooksOsErrorHook, OsPostTaskHook, OsPreTaskHook, OsShutdownHook, OsStartupHook all FALSE
OSDEFAULTAPPMODEOsAppModeNone
RES_AUTOSAR_ECUMOsResourceOsResourceProperty STANDARD
OsCounter_0OsCounterOsCounterMaxAllowedValue 1000000, OsCounterMinCycle 1, OsCounterTicksPerBase 1, OsCounterType HARDWARE, OsSecondsPerTick 0.01
OsTask_0OsTaskOsTaskActivation 1, OsTaskPeriod 0.01, OsTaskPriority 2, OsTaskSchedule FULL, OsTaskStackSize 32768
OsTask_EcuMStartupOsTaskOsTaskActivation 1, OsTaskPriority 3, OsTaskSchedule FULL, OsTaskStackSize 32768
OsTask_EcuMStartup/OsTaskAutostartOsTaskAutostartOsTaskAppModeRef Os/OSDEFAULTAPPMODE
OsTask_2OsTaskOsTaskActivation 1, OsTaskPeriod 0.02, OsTaskPriority 1, OsTaskSchedule FULL, OsTaskStackSize 32768
OsTask_3OsTaskOsTaskActivation 1, OsTaskPeriod 0.01, OsTaskPriority 1, OsTaskSchedule FULL, OsTaskStackSize 32768
OsAlarm_0OsAlarmOsAlarmCounterRef Os/OsCounter_0
OsAlarm_0/OsAlarmActionOsAlarmActionNone
OsAlarm_0/OsAlarmAction/OsAlarmActivateTaskOsAlarmActivateTaskOsAlarmActivateTaskRef Os/OsTask_0
OsAlarm_1OsAlarmOsAlarmCounterRef Os/OsCounter_0
OsAlarm_1/OsAlarmActionOsAlarmActionNone
OsAlarm_1/OsAlarmAction/OsAlarmActivateTaskOsAlarmActivateTaskOsAlarmActivateTaskRef Os/OsTask_2
OsAlarm_2OsAlarmOsAlarmCounterRef Os/OsCounter_0
OsAlarm_2/OsAlarmActionOsAlarmActionNone
OsAlarm_2/OsAlarmAction/OsAlarmActivateTaskOsAlarmActivateTaskOsAlarmActivateTaskRef Os/OsTask_3

Setting Up the Operating System​

  1. Click Os in the list. The CONFIGURATION tree lists the container definitions of Os, all empty. Click + on the OsOS row. The editor adds OsOS and selects it.

    The OsOS row in the Os tree

    Figure 7-1. ① Os, ② the OsOS row, ③ +.

  2. In the panel on the right, choose EXTENDED for OsStatus. Click TRUE for OsStackMonitoring, OsUseGetServiceId and OsUseParameterAccess.

    The values of OsOS

    Figure 7-2. ① OsOS, ② OsStatus, ③ OsStackMonitoring, ④ OsUseGetServiceId, ⑤ OsUseParameterAccess.

  3. Under OsOS, click + on the OsHooks row and click FALSE for the five hooks.

  4. Click + on the OsAppMode row. In Name, replace the given name with OSDEFAULTAPPMODE and press Tab.

  5. Click + on the OsResource row. Rename it to RES_AUTOSAR_ECUM the same way and choose STANDARD for OsResourceProperty.

    The two names must be exact: the EcuM configuration you entered in PRTE Setup refers to them.

  6. Click + on the OsCounter row and enter the values of OsCounter_0 from the table.

Creating the Tasks​

  1. Click + on the OsTask row. The editor adds OsTask_0 and selects it.

    The OsTask row in the Os tree

    Figure 7-3. ① Os, ② the OsTask row, ③ +.

  2. Enter the values of OsTask_0 from the table.

    The values of OsTask_0

    Figure 7-4. ① OsTask_0, ② OsTaskActivation, ③ OsTaskPeriod, ④ OsTaskPriority, ⑤ OsTaskSchedule, ⑥ OsTaskStackSize.

  3. Click + on the OsTask row again. The editor adds OsTask_1. In Name, replace it with OsTask_EcuMStartup and press Tab. Enter its values from the table and leave OsTaskPeriod empty.

    The values of OsTask_EcuMStartup

    Figure 7-5. ① OsTask_EcuMStartup, ② Name, ③ OsTaskActivation, ④ OsTaskPriority, ⑤ OsTaskSchedule, ⑥ OsTaskStackSize.

  4. Under OsTask_EcuMStartup, click + on the OsTaskAutostart row. In the new OsTaskAutostart, pick Os/OSDEFAULTAPPMODE for OsTaskAppModeRef.

    The OsTaskAutostart of OsTask_EcuMStartup

    Figure 7-6. ① OsTaskAutostart, ② OsTaskAppModeRef.

  5. Click + on the OsTask row again. The editor names the new task OsTask_1 again, because that number is free. Rename it to OsTask_2 and enter its values from the table.

  6. Create OsTask_3 the same way: + gives OsTask_1, which you rename to OsTask_3.

Creating the Alarms​

  1. Click + on the OsAlarm row. In the new OsAlarm_0, pick Os/OsCounter_0 for OsAlarmCounterRef.

    The values of OsAlarm_0

    Figure 7-7. ① OsAlarm_0, ② OsAlarmCounterRef.

  2. Under OsAlarm_0, click + on the OsAlarmAction row. Under the new OsAlarmAction, click + on the OsAlarmActivateTask row.

    The OsAlarmActivateTask row under OsAlarmAction

    Figure 7-8. ① Os, ② the OsAlarmActivateTask row under OsAlarm_0/OsAlarmAction, ③ +.

  3. In the new OsAlarmActivateTask, pick Os/OsTask_0 for OsAlarmActivateTaskRef.

    The values of OsAlarmActivateTask

    Figure 7-9. ① OsAlarmActivateTask, ② OsAlarmActivateTaskRef.

  4. Create OsAlarm_1 and OsAlarm_2 the same way from the table. OsAlarm_1 activates OsTask_2, and OsAlarm_2 activates OsTask_3.

  5. Save with Ctrl+S.

Why Is It Designed This Way?​

  • Fixed names. The EcuM of PRTE Setup names OSDEFAULTAPPMODE and RES_AUTOSAR_ECUM. PAIO writes the start-up task source src/EcuM_StartupTask.c only for a task named OsTask_EcuMStartup.
  • One task per timing. OsTask_0 runs the BSW main functions every 10 ms, OsTask_2 the sensor runnable every 20 ms, and OsTask_3 the actuator runnables and the BswM poll. Chapter 8 maps the events to these tasks and alarms.
  • The start-up task. OsTask_EcuMStartup has no period. OsTaskAutostart starts it once in OSDEFAULTAPPMODE, and its priority 3 is the highest.
  • One counter. OsCounter_0 ticks every 0.01 s and drives all three alarms.
  • EXTENDED. The extended status makes the OS services report errors, which helps during development.

Checklist​

  • The CONFIGURATION tree of Os holds OsOS, OSDEFAULTAPPMODE, RES_AUTOSAR_ECUM and OsCounter_0.
  • It holds the four tasks OsTask_0, OsTask_EcuMStartup, OsTask_2 and OsTask_3.
  • OsAlarm_0, OsAlarm_1 and OsAlarm_2 activate OsTask_0, OsTask_2 and OsTask_3.
  • The tab VehicleDesign:Configuration carries no modified mark.

Next Step​

In Rte Configuration you map the runnables and BSW main functions to these tasks.