This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE : Powerpc stack initialization


On Wed, 2004-02-04 at 08:16, David POUTY wrote:
> I have forgotten to specify an important thing: In my opinion this patch
> is usefull only with RedBoot.
> In fact, there's a stack corruption when you execute an application from
> RedBoot. Then, when you return from your application RedBoot crash
> (return from do_go() function).
> The corruption occurs when interrupt are enabled (with hal_cpu_int_merge
> macro) in function hal_thread_load_context().
> An other solution, is to disable
> CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK when building RedBoot.
> 
> You can see the origin of this problem in that post:
> http://ecos.sourceware.org/ml/ecos-discuss/2004-01/msg00080.html
> 

Indeed.  I think that this should be the case for all versions of 
RedBoot, so I'm committing the attached patch.

n.b. I now understand your patch, but I don't think it's good enough for
all cases (in particular running non-eCos programs which make use of
interrupts would totally trash RedBoot's stack and your patch would not
help).  Simply disabling this feature in RedBoot is the correct
approach.

Thanks for bringing this to my attention.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.176
diff -u -5 -p -r1.176 ChangeLog
--- redboot/current/ChangeLog	18 Jan 2004 17:42:47 -0000	1.176
+++ redboot/current/ChangeLog	4 Feb 2004 15:40:06 -0000
@@ -1,5 +1,11 @@
+2004-02-04  Gary Thomas  <gary@mlbassoc.com>
+
+	* cdl/redboot.cdl: Do not build with "common" interrupt stack
+	support.  This can cause problems when running programs (via
+	the "go" command) as interrupts will corrupt RedBoot's stack.
+
 2004-01-18  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/main.c: Fix build problem if GDB stubs are not included.
 	Minor warning cleanup (cast on NO_MEMORY).
 
Index: redboot/current/cdl/redboot.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/cdl/redboot.cdl,v
retrieving revision 1.61
diff -u -5 -p -r1.61 redboot.cdl
--- redboot/current/cdl/redboot.cdl	8 Dec 2003 15:37:45 -0000	1.61
+++ redboot/current/cdl/redboot.cdl	4 Feb 2004 15:38:18 -0000
@@ -7,11 +7,11 @@
 # ====================================================================
 #####ECOSGPLCOPYRIGHTBEGIN####
 ## -------------------------------------------
 ## This file is part of eCos, the Embedded Configurable Operating System.
 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-## Copyright (C) 2002, 2003 Gary Thomas
+## Copyright (C) 2002, 2003, 2004 Gary Thomas
 ##
 ## eCos is free software; you can redistribute it and/or modify it under
 ## the terms of the GNU General Public License as published by the Free
 ## Software Foundation; either version 2 or (at your option) any later version.
 ##
@@ -54,10 +54,14 @@ cdl_package CYGPKG_REDBOOT {
     doc           ref/redboot.html
     define_header redboot.h
     description   "
            This package supports the Redboot \[stand-alone debug monitor\]
            using eCos as the underlying board support mechanism."
+
+    # Use of separate interrupt stack causes problems when running
+    # programs as they can end up trashing RedBoot's stack
+    requires { CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK == 0 }
 
     # Since the CYGDAT_REDBOOT_CONSOLE_DEV setting ends up in the platform
     # HAL header, we need to include that here (via hal.h).
     define_proc {
         puts $::cdl_header "#include <pkgconf/hal.h>"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]