Refactorization of default program support to be given as command

Issue #239 on hold
Patryk Kubiak created an issue

Implementation reason

In current implementation it is not possible to set user-space program as default program in the system configuration. Moreover we cannot add additional command arguments into the default program instance. The system should provide such possibility.

Generic Description

The system has to provide a possibility to run default program as command for the default console provider. Moreover it should be possible to disable running default program if it is not needed. Default program should be defined as string in the system configuration. The system should try to use it as program name and try to find the default program on the programs list, and if it is not possible (and console provider is available) then it should try to run it as command for console provider. Moreover global variable DefaultProgram and function oC_ProgramMan_GetDefaultProgram should be removed.

Required Interface

// Set it to ON/OFF to enable/disable default program usage

The definition should be added to oc_programs_list.h. If it is set to OFF, the system should not use default program and all functions related to the default program should return error code oC_ErrorCode_FunctionalityDisabled


// String with name of program or command for console provider to run 

The definition should be added to oc_programs_list.h. It is name of a program from embedded programs list or command to execute in console provider.


// Checks if the default program is already running and if it is not, it starts it again
extern oC_ErrorCode_t oC_ProgramMan_RerunDefaultIfNotRunning( oC_User_t User );

The function oC_ProgramMan_RerunDefualtIfNotRun has to be refactored to treat the default program as command instead of program. Pointer to the process of default program has to be kept in global variable and the function should use the process pointer to verify that default program is running instead of usage of program name. Moreover the function should be renamed to oC_ProgramMan_RerunDefaultIfNotRunning.


// Runs new instance of default program
// If outProcess is not NULL, the function uses it to return a process created for the program
oC_ErrorCode_t oC_ProgramMan_RunDefaultProgram( oC_User_t User, oC_Process_t * outProcess );

The function oC_ProgramMan_RunDefaultProgram has to be refactored to use definition CFG_STRING_DEFAULT_PROGRAM_COMMAND. Firstly it should treat the definition as program-name and use it to find a program with the given name on the programs list by using oC_ProgramMan_GetProgram. If it is not possible and console provider is enabled, the function should treat the definition as command for console provider by using function oC_ProgramMan_RunCommand. The function should return created process object in the function parameter outProcess if it is not NULL


Link to trello board:


  • [ #245 ] - Providing support of standard system providers

List of requirements

  • [ #239 ] - Default program defined as command for console provider
  • [ #239 ] - Possibility of choosing cbin and elf files as default program
  • [ #239 ] - Possibility of disabling default program if it is not needed
  • [ #239 ] - Possibility of adding command arguments to the default program

Comments (4)

  1. Log in to comment