[ECOS] ecos-3.0 current stm32 bug?

Christophe Coutand ccoutand@stmi.com
Thu Aug 25 09:37:00 GMT 2011


Try to word align hal_switch_state_vsr (currently you have 0x8040025) and see what happens. Also can you post the dissembled version to understand why hal_switch_state_vsr is placed like that.

Christophe

> -----Original Message-----
> From: Philipp Meier [mailto:pme.neratec@gmx.ch]
> Sent: 25. august 2011 10:49
> To: Christophe Coutand; ecos-discuss@ecos.sourceware.org
> Subject: Re: RE: RE: [ECOS] ecos-3.0 current stm32 bug?
> 
> Hello Christophe
> 
> it is the SWI instruction ("svc 0" in disassem code) that triggers the
> exception (therefore breakpoint in hal_switch_state_vsr is never
> reached).
> 
> Where does the SWI instruction get's it's information about where to
> jump to? Is it the hal_vsr_table (located at 0x20000000)? In entry 11 I
> have 0x8040025 which is the address for hal_switch_state_vsr - and yet
> it does not jumps to 0x8040025 but instead to 0x8040042
> (hal_default_exception_vsr).
> 
> Any idea about the reason for this behaviour?
> 
> Cheers Philipp
> 
> -------- Original-Nachricht --------
> > Datum: Wed, 24 Aug 2011 09:40:02 -0700
> > Von: "Christophe Coutand" <ccoutand@stmi.com>
> > An: "Philipp Meier" <pme.neratec@gmx.ch>, ecos-
> discuss@ecos.sourceware.org
> > Betreff: RE: RE: [ECOS] ecos-3.0 current stm32 bug?
> 
> > What about setting a breakpoint in hal_switch_state_vsr? Is it the
> SWI
> > instruction that triggers the exception or is it the execution of the
> > hal_switch_state_vsr routine?
> >
> > Christophe
> >
> > > -----Original Message-----
> > > From: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss-
> > > owner@ecos.sourceware.org] On Behalf Of Philipp Meier
> > > Sent: 24. august 2011 16:58
> > > To: ecos-discuss@ecos.sourceware.org
> > > Subject: Re: RE: [ECOS] ecos-3.0 current stm32 bug?
> > >
> > > Hello Christophe,
> > >
> > > Yes - both are ROM startup type. The bootloader without offset
> (i.e.
> > > offset 0x0), the application with offset 0x40000.
> > >
> > > In the bootloader elf file hal_vsr_table is 20000000 and the same
> is
> > > true for the application.
> > >
> > > GDB debug output when debugging the startup of the application:
> > >
> > > Bad case (Linux built bootloader):
> > > ----------------------------------
> > > (gdb) print /fx hal_vsr_table
> > > $1 = {0x441c4c08, 0x61232301, 0x8040043, 0x8040043, 0x8040043,
> > > 0x8040043, 0x8040043, 0x8040043, 0x8040043, 0x8040043,
> > >   0x8040043, 0x8040025, 0x8040043, 0x8040043, 0x8040089, 0x8040075
> > > <repeats 61 times>}
> > > (gdb) print /fx &hal_vsr_table
> > > $2 = 0x20000000
> > >
> > > Good case (Cygwin built bootloader):
> > > ----------------------------------
> > > (gdb) print /fx hal_vsr_table
> > > $1 = {0x4024f8df, 0xf04f4d09, 0x8040043, 0x8040043, 0x8040043,
> > > 0x8040043, 0x8040043, 0x8040043, 0x8040043, 0x8040043,
> > >   0x8040043, 0x8040025, 0x8040043, 0x8040043, 0x8040089, 0x8040075
> > > <repeats 61 times>}
> > > (gdb) print /fx &hal_vsr_table
> > > $2 = 0x20000000
> > >
> > > Cheers
> > > Philipp
> > >
> > > -------- Original-Nachricht --------
> > > > Datum: Wed, 24 Aug 2011 07:22:53 -0700
> > > > Von: "Christophe Coutand" <ccoutand@stmi.com>
> > > > An: "Philipp Meier" <pme.neratec@gmx.ch>, "ecos discuss" <ecos-
> > > discuss@ecos.sourceware.org>
> > > > Betreff: RE: [ECOS] ecos-3.0 current stm32 bug?
> > >
> > > > Both the bootloader and the application are ROM startup type?
> > > >
> > > > What about the address of the hal_vsr_table in the bootloader and
> > > > application?
> > > >
> > > > Christophe
> > > >
> > > > > -----Original Message-----
> > > > > From: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-
> discuss-
> > > > > owner@ecos.sourceware.org] On Behalf Of Philipp Meier
> > > > > Sent: 24. august 2011 16:11
> > > > > To: ecos discuss
> > > > > Subject: Re: [ECOS] ecos-3.0 current stm32 bug?
> > > > >
> > > > > -------- Original-Nachricht --------
> > > > > > Datum: Wed, 24 Aug 2011 14:35:15 +0300 (EEST)
> > > > > > Von: Sergei Gavrikov <sergei.gavrikov@gmail.com>
> > > > > > An: Philipp Meier <pme.neratec@gmx.ch>
> > > > > > CC: ecos-discuss@ecos.sourceware.org
> > > > > > Betreff: Re: [ECOS] ecos-3.0 current stm32 bug?
> > > > >
> > > > > > On Wed, 24 Aug 2011, Philipp Meier wrote:
> > > > > >
> > > > > > > Hi all
> > > > > > >
> > > > > > > I have a firmware split into two parts:
> > > > > > >  1. a "bootloader"
> > > > > > >  2. a "application"
> > > > > > >
> > > > > > > I now need to move from Windows (cygwin) development
> > > environment to
> > > > > > > Linux development environment and at the same time use the
> > > current
> > > > > > > ecos version (i.e. what I get when I clone the ecos
> mercurial
> > > > > > > repository) instead of the "original" (back in 2009) ecos-
> 3.0
> > > > > version.
> > > > > > >
> > > > > > > The situation is now as follows:
> > > > > > >  1. I download (to my stm32 device) the Linux/ecos-current
> > > built
> > > > > > >  "bootloader"
> > > > > > >  2. I download (to my stm32 device) the Linux/ecos-current
> > > built
> > > > > > >  "application"
> > > > > > >  3. I start the application and in line 187 of file
> > > > > > >  'hal/cortexm/arch/current/src/hal_msic.c' instead of
> branching
> > > to
> > > > > > >  'hal_switch_state_vsr' it branches to
> > > 'hal_default_exception_vsr'
> > > > > > >  function!
> > > > > > >
> > > > > > > To analyze the problem I then:
> > > > > > >  4. Downloaded (to my stm32 device) the cyginw/ecos-3.0
> built
> > > > > > >  "bootloader"
> > > > > > >  5. Still having the Linux/ecos-current built "application"
> > > > > > >  6. And in line 187 (of the above mentioned file) it
> branches
> > > (as
> > > > > it
> > > > > > >  should) to 'hal_switch_state_vsr' and the application is
> > > starting
> > > > > up
> > > > > > >  and running fine!
> > > > > > >
> > > > > > > Who can give me a hint about
> > > > > > >  * what has been changed in ecos-current cortexm stm32 that
> > > could
> > > > > > >  cause this problem
> > > > > >
> > > > > > Hi Philipp,
> > > > > >
> > > > > > I think you can use Mercurial for that
> > > > > >
> > > > > > % hg tags | grep v3
> > > > > > ecos-v3_0-branchpoint           2821:b5a12bb6a634
> > > > > >
> > > > > > % hg log -r ecos-v3_0-branchpoint:tip
> packages/hal/cortexm/arch |
> > > > > less
> > > > > > -FRSX
> > > > > >
> > > > > > or (may be)
> > > > > >
> > > > > > % hg log --patch -r ecos-v3_0-branchpoint:tip \
> > > > > > 	packages/hal/cortexm/arch/current/src/hal_misc.c | less -
> > > FRSX
> > > > > >
> > > > > > etc.
> > > > > >
> > > > > > >  * or what else I could analyze to find out why ecos-
> current
> > > (built
> > > > > on
> > > > > > >  Linux, arm-eabi-gcc (eCosCentric GNU tools 4.3.2-sw);
> under
> > > cygwin
> > > > > I
> > > > > > >  also used the arm-eabi-gcc version 4.3.2 pre-built by
> > > eCosCentric)
> > > > > >
> > > > > > Also you would check the Linux build for ecos-3.0 codebase
> > > > > >
> > > > > > # get old (working) code
> > > > > > % hg update ecos-v3_0-branchpoint
> > > > > >
> > > > > > Rebuild your loader and application under Linux and try it
> (use
> > > fresh
> > > > > > directories for builds). After all do not forget up-to-date
> eCos
> > > HG
> > > > > > repository (hg update default).
> > > > > >
> > > > > > Feel free to submit a bug report (if you'll find something)
> via
> > > eCos
> > > > > > Bugzilla System http://bugs.ecos.sourceware.org/
> > > > > >
> > > > > >
> > > > > > Sergei
> > > > > >
> > > > > > > Regards
> > > > > > > Philipp
> > > > >
> > > > > Hello Sergei and others
> > > > >
> > > > > Thanks a lot for your tips about how to find out the
> differences
> > > > > between the versions.
> > > > >
> > > > > I now went a step back and built (under Linux) my "bootloader"
> and
> > > my
> > > > > "application" under Linux using the same ecos sources and
> > > configuration
> > > > > files as when I built them under Windows/cygwin.
> > > > >
> > > > > Therefore - I wanted to see if the problem comes from building
> > > under
> > > > > Linux, or from changes in the ecos stm32 parts (or any other
> ecos
> > > > > parts).
> > > > >
> > > > > But - I have the same problem as described above; i.e. the
> problem
> > > must
> > > > > be somehow in my Linux toolchain?
> > > > >
> > > > > Therefore my question now is:
> > > > > Can anybody give me some background information about how the
> > > "__asm__
> > > > > volatile( "swi" )" statement in line 188 of
> > > > > packages/hal/cortexm/arch/v3_0/src/hal_misc.c (or "swi 0" line
> 187
> > > in
> > > > > packages/hal/cortexm/arch/current/src/hal_misc.c when using
> ecos-
> > > > > current) is interpreted on stm32? What could be the reason that
> it
> > > does
> > > > > not jumps to "hal_switch_state_vsr" but instead jumps to
> > > > > "hal_default_exception_vsr"?
> > > > >
> > > > > The lines where the different behaviour is look like this:
> > > > > hal_vsr_table[CYGNUM_HAL_VECTOR_SERVICE] =
> > > > > (CYG_ADDRESS)hal_switch_state_vsr;
> > > > >
> > > > > __asm__ volatile( "swi" );
> > > > >
> > > > > ...
> > > > >
> > > > > In the good case these leads to a jump/branch to
> > > hal_switch_state_vsr
> > > > > and in the bad case it jumps/branches to
> hal_default_exception_vsr
> > > and
> > > > > therefore my application does not starts up.
> > > > >
> > > > > Thanks for any help.
> > > > >
> > > > > Philipp
> > > > > --
> > > > > P.S.: Sorry Sergei - I did not mean to reply directly to you
> but
> > > like
> > > > > this to the mailing list.
> > > > > --
> > > > > NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-
> Garantie!
> > > > >
> > > > > Jetzt informieren: http://www.gmx.net/de/go/freephone
> > > > >
> > > > > --
> > > > > Before posting, please read the FAQ:
> > > > > http://ecos.sourceware.org/fom/ecos
> > > > > and search the list archive:
> http://ecos.sourceware.org/ml/ecos-
> > > discuss
> > > >
> > >
> > > --
> > > NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
> > >
> > > Jetzt informieren: http://www.gmx.net/de/go/freephone
> > >
> > > --
> > > Before posting, please read the FAQ:
> > > http://ecos.sourceware.org/fom/ecos
> > > and search the list archive: http://ecos.sourceware.org/ml/ecos-
> discuss
> >
> 
> --
> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
> 
> Jetzt informieren: http://www.gmx.net/de/go/freephone


More information about the Ecos-discuss mailing list