/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / USB PrimerVirtualCOM 1.1 without CircleOS

Username:     
Password:     
             

Forum

# 1   2012-11-04 07:44:18 USB PrimerVirtualCOM 1.1 without CircleOS

yusufilker
New member
Registered: 2008-01-31
Posts: 3

USB PrimerVirtualCOM 1.1 without CircleOS

Hello,

I am trying to remove CircleOS calls from the PrimerVirtualCOM 1.1 source and trying to make it standalone application. Following changes are applied.

- Application.c is renamed as main.c

- enum MENU_code Application_Ini ( void ) is renamed as void init(void), return line is deleted, CIRCLEOS_RAM_BASE is set to 0x0.

- enum MENU_code Application_Handler ( void ) is renamed as void main (void), return line is deleted , the above init(); function is called at the beginig, for continious operation everything is put in for(;wink loop,  except init();.

- CircleOs related functions like DRAW_DisplayString, UTIL_uint2str is not used, these are just for LCD display purposes.

New code is compiled successfully but when I plug it to computer,  windows 7 says Unknown device , basicly I didn't make any usb related change.  Is CircleOS making changes to USB registers?

Thanks,

Offline

 

# 2   2012-11-05 07:23:53 USB PrimerVirtualCOM 1.1 without CircleOS

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

Re: USB PrimerVirtualCOM 1.1 without CircleOS

If you want to make the application standalone, you have to add a startup to it (start program and interrupt vector table), which was provided by CircleOS, or let Ride to provide it by default.

Offline

 

# 3   2012-11-05 18:04:26 USB PrimerVirtualCOM 1.1 without CircleOS

yusufilker
New member
Registered: 2008-01-31
Posts: 3

Re: USB PrimerVirtualCOM 1.1 without CircleOS

Thank you for the reply.
After changes,  I created new project in Ride 7.
Project->Properties->LD linker says Use default startup:Yes
still unknown device.

Offline

 

# 4   2012-11-06 07:19:59 USB PrimerVirtualCOM 1.1 without CircleOS

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

Re: USB PrimerVirtualCOM 1.1 without CircleOS

Ok, if the default startup does not work, get the Circle one : "CircleStartup_spe.s", corresponding to your platform (Primer2, EvoPrimer...).

Offline

 

# 5   2012-11-07 04:47:01 USB PrimerVirtualCOM 1.1 without CircleOS

yusufilker
New member
Registered: 2008-01-31
Posts: 3

Re: USB PrimerVirtualCOM 1.1 without CircleOS

thw working original code was like:

//Set IRQ Handler
   #define ID_IRQ_USB_LP  (0x90)               
   OldHandler = (tHandler)UTIL_GetIrqHandler( ID_IRQ_USB_LP );
   UTIL_SetIrqHandler(ID_IRQ_USB_LP, (u32)USB_Istr);     

UTIL_SetIrqHandler() and UTIL_GetIrqHandler() functions are from Util.c of circleOS.
Since the vector table is relocated in RAM, these functions is used to relocate USB_Istr().

tHandler UTIL_GetIrqHandler( int Offs )
   {
   if ( (Offs >= 8) && (Offs<0x100) )
      return *(tHandler *)( CIRCLEOS_RAM_BASE + Offs );
   }

void UTIL_SetIrqHandler( int Offs, tHandler pHDL )
   {
   if ( (Offs >= 8) && (Offs<0x100) )
      *(tHandler *)( CIRCLEOS_RAM_BASE + Offs ) = pHDL;
   }



now I am trying to replace above code with a single line: none of the below is working. (omit oldhandler backup) (yes my pointer knowlegde is not good enough to understand probably.. *(tHandler *)  is type casting i think..)

      *(tHandler *)( CIRCLEOS_RAM_BASE + ID_IRQ_USB_LP ) =(u32)USB_Istr;
      *(tHandler *)( CIRCLEOS_RAM_BASE + ID_IRQ_USB_LP ) =&USB_Istr;
      *(tHandler *)( CIRCLEOS_RAM_BASE + ID_IRQ_USB_LP ) =*USB_Istr;

next step is obviously removing CIRCLEOS_RAM_BASE
      *(tHandler *)( ID_IRQ_USB_LP ) =&USB_Istr;


thanks

Last edited by yusufilker (2012-11-07 04:47:43)

Offline

 

# 6   2012-11-07 07:46:16 USB PrimerVirtualCOM 1.1 without CircleOS

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

Re: USB PrimerVirtualCOM 1.1 without CircleOS

These functions are used to allow CircleOS applications to relocate interrupt vectors.
If you do not use CircleOS, you have just to provide your own vector table as your own startup program, that you can copy from CircleOS sources, as I said previously.

Offline

 

Board footer