/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Creating an auto run app?

Username:     
Password:     
             

Forum

# 1   2009-11-27 20:05:33 Creating an auto run app?

adderd
New member
From: Earth
Registered: 2009-11-20
Posts: 8

Creating an auto run app?

What would be the best way to go about creating a way for the CircleOS to automatically run a certain application? I guess what I'm really after is to just use circleos as an api. Would it be best to make it auto run an app or should I figure out how to disable the code that runs at startup and replace it with my own? Maybe it would be nice for the system to still have the ability to run other apps though...

On a related note... How about a good way to automatically turn the unit on when it gets a signal? It seems like pin 14 of the extension connector could be used for this. Is this correct?

Offline

 

# 2   2009-11-30 08:00:01 Creating an auto run app?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Creating an auto run app?

Hi,

You may use the CirceOS as an API, but it is usefull for the hardware initialization.

You can also launch automatically an application on startup. We have forseen to add a "autorun" option for future CircleOs versions.
You can find hereafter the code to launch the last application, you can add at the end of initialization phase of main.c, before the "AUDIO_Welcome_Msg" :

    s32 CurrentApplicationIndex = -1;
    long unsigned  addr;
    tMenuItem*     ((*ApplicationTable) []);

    // Retrieve the last appli index
    CurrentApplicationIndex = UTIL_ReadBackupRegister(BKP_SYS1);

    // Search the adress of the selected application
    unsigned long *lptr = (unsigned long *) CIRCLEOS_FAT_ADDRESS;
    ApplicationTable  = (tMenuItem * ((*) [])) (*lptr);

    // First, we search for extra applications;
    if( (*ApplicationTable) [ -CurrentApplicationIndex ] != APP_VOID )
        {
        addr   = (long unsigned) (*ApplicationTable) [ -CurrentApplicationIndex ] ;
        addr &= 0x00FFFFFF;
        addr |= 0x08000000;
        CurrentCommand = (tMenuItem*) addr;

        // Disable menu and screen rotation
        fDisplayTime = 0;
        CurrentMenu = 0;
        BUTTON_SetMode( BUTTON_ONOFF );
        POINTER_SetMode( POINTER_OFF );
        LCD_SetRotateScreen( 0 );
        DRAW_Clear();

        // Disable scribble touchscreen mode
        TOUCHSCR_SetMode( TS_NORMAL );
       
        // Restore the menu divider
        MENU_RestoreAppliDivider();

        // Launch the selected application
        return CurrentCommand->Fct_Init()

        }

Concerning the wakeup, the STM32 possesses several modes : sleep (CPU clock off), stop (all clocks stopped), and standby (regulator powered-off).
Any interrupt can go out from sleep mode, any EXTI line can go out from Stop mode, WKUP pin rising edge (= pin 14 extension connector), RTC alarm, or external reset in NRST pin, or IWDG reset can go out from standby.

For wakeup the STM32 with the WKUP pin, you must set the EWUP bit (Enable WKUP pin) in the Power control/status register (PWR_CSR).
You can take a look to the "Power control" paragraph of the STM32 documentation (reference manual RM0008).

Yves

Offline

 

# 3   2009-11-30 09:16:23 Creating an auto run app?

mdce
Member
Registered: 2009-09-25
Posts: 25

Re: Creating an auto run app?

Hi,
I added this code into the main.
The screen of the last application is well displayed, but all is locked.
What is missing there?

Offline

 

# 4   2009-11-30 10:47:54 Creating an auto run app?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Creating an auto run app?

Sorry, the main.c will be a little different in the future !

So, for your version, you have to move these lines before the launch of the application :

    DRAW_Init();     /* DRAW configuration               */
   
    fInitDone = 1;

Regards,
Yves

Offline

 

# 5   2009-11-30 11:35:20 Creating an auto run app?

mdce
Member
Registered: 2009-09-25
Posts: 25

Re: Creating an auto run app?

I do not understand, but it works !
Pity there is no good documentation about CircleOS and there API !

Regards.

Offline

 

# 6   2009-12-01 08:04:24 Creating an auto run app?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Creating an auto run app?

Yes, we know we have to improve the quantity and the quality of our documentation...

Your problem was that the set of the flag fInitiDone indicates the end of all hardware initialization.
Some handlers do nothing until this flag is set, so an application must not be launched before.

Yves

Offline

 

Board footer