Skip to content
Jaume Olivé Petrus edited this page Sep 17, 2018 · 16 revisions

About this

When Lua RTOS launches the Lua interpreter, and before the Lua prompt appears, 2 scripts are automatically executed. These scripts reside in the root directory and are written in Lua:

  1. system.lua

    This script is intended for setup the system, for example enable Lua RTOS configurations disabled by default, modify default configurations, setup a network connection, etc. The system.lua script is optional, and nothing happens if it's not present in the root directory.

    Example:

    -- Set the syslog level
    os.loglevel(os.LOG_INFO)
    
    -- Show the messages generated by the syslog in the console
    os.logcons(true)
    
    -- Enable the shell
    os.shell(true)
  2. autorun.lua

    This script is intended for setup and launch your application, and it's executed after the system.lua completion. The autorun.lua script is optional, and nothing happens if it's not present in the root directory.

    Example:

    -- Execute the application
    dofile("application.lua")

Why 2 startup scripts?

During the Lua RTOS design phase, the Lua RTOS team decided to create this 2 startup scripts for allow external IDE (Integrated Development Environment) to send the application code to the board without losing the system settings. Settings goes to the system.lua script, and the application goes to the autorun.lua script.

Can I avoid the execution of the startup scripts?

Yes. If you want to avoid the execution of the startup scripts, connect to the Lua RTOS console using your favorite terminal emulator program, and press the Ctrl-D key while Lua RTOS is booting.

Clone this wiki locally