Re: [Cegcc-devel] native gcc on arm

2007-04-25 Thread bernhard
On 23.04.2007, at 23:00, Pedro Alves wrote:

> bernhard escreveu:
>> Hi! I have a 'newbie' question...
>> Is there a way to have gcc run native on a arm device?
>
> It has been done before:
> http://pocketgcc.sourceforge.net/
>
> I never saw their sources, but I guess it was based on Voxware's
> toolchain.  With some work, it should be possible to have native
> cegcc->cegcc, or cegcc->mingw32ce compilers.  Not really sure there
> is real use for it though.
>
>> I was able to build a gcc toolchain (mingw32ce and cegcc) on my   
>> MacOSX to do cross-compiling,
>
>
> Interesting, so you were able to build it.  For the archives, could
> you explain what was going wrong before, and how you solved it?

Of course!
It was not really hard to get it going. The first problem i ran into  
was that on my OSX box the 'readlink -f .' would not do the obvious.  
I replaced it with `pwd`:

8<
$ svn diff build-mingw32ce.sh
Index: build-mingw32ce.sh
===
--- build-mingw32ce.sh  (Revision 916)
+++ build-mingw32ce.sh  (Arbeitskopie)
@@ -3,9 +3,9 @@
if [ $# -lt 2 ] ; then
echo "Using defaults:"
-export BASE_DIRECTORY=`readlink -f .`
+export BASE_DIRECTORY=`pwd`
export BUILD_DIR=${BASE_DIRECTORY}/build-mingw32ce
-export PREFIX=/opt/mingw32ce
+export PREFIX=${BASE_DIRECTORY}/opt/mingw32ce
if [ $# -lt 1 ] ; then
BUILD_OPT="all"

>8

I also decided to use another prefix dir, but that is not really  
important. I made this changes in "build-mingw32ce.sh" and in "build- 
cegcc.sh".

8<
$ svn diff build-cegcc.sh  Index: build-cegcc.sh
===
--- build-cegcc.sh  (Revision 916)
+++ build-cegcc.sh  (Arbeitskopie)
@@ -2,9 +2,9 @@
if [ $# -lt 2 ] ; then
echo "Using defaults:"
-  export BASE_DIRECTORY=`readlink -f .`
+  export BASE_DIRECTORY=`pwd`
export BUILD_DIR=${BASE_DIRECTORY}/build-cegcc
-  export PREFIX=/opt/cegcc
+  export PREFIX=${BASE_DIRECTORY}/opt/cegcc
if [ $# -lt 1 ] ; then
  BUILD_OPT="all"

>8

After that changes i was able to start both build scripts without  
parameters. Unfortunately gdb does not build using "build-mingw32ce.sh":
.../cegcc/src/gdb/gdb/exceptions.h:165: error: parse error before  
‘va_list’
make[2]: *** [gdb.o] Error 1
make[1]: *** [all-gdb] Error 2
make: *** [all] Error 2

"build-cegcc.sh" runs *perfectly*well* without any complaints!!!

> since i would like to have Python and
>> PyGame running on my mobile device. But unfortunately Python needs  
>> to  execute some c code during configuration, and that is not  
>> possible on  the build system; Bootstrapping of Python is also  
>> quite host- dependent i am afraid. Maybe i would be off better if  
>> i had gcc  running directly on my mobile device;
>
> Isn't Python ported to WinCE already?  A quick google shows up:
> http://sourceforge.net/projects/pythonce
>
> Should be easy to port it that mingw32ce.  Should be mostly
> a matter of changing the build system.
>
> But, since mingw32ce is based on gcc, it has a bigger chance
> of being integrated into the official build systems, at
> least when they use autoconf.  I have no idea what python uses,
> but doesn't it have any support for being cross-built?

It has; But unfortunately it is somewhat tricky to cross build it, it  
needs 'python' for bootstrapping. I will try to find out how i can  
use an existing python interpreter to handle bootstrapping of an  
other python interpreter that is being built but never 'run'.

>> Any ideas are welcome, i hope i can make PyGame run on an arm  
>> device  without having to use M$ Visual Studio...

PyGame is the thing i want to run; I got PythonCE running, but i can  
not import pygame with it...

>> Btw thank you all for the wonderful basis - CeGCC is cool.
>
> Thanks, welcome on board!
>
>> PS.: PocketConsole seemt to be disfunctional on wince5.0?
>
> Have you already tried to set
> HKEY_LOCAL_MACHINE\Drivers\Console\OutputTo to 0 ?

That SOLVED the problems :-)

And still I hope i can make pygame and gdb run...

Georg Gogo. BERNHARD



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel


[Cegcc-devel] New build script (Was: Re: native gcc on arm)

2007-04-25 Thread Pedro Alves

bernhard wrote:

On 23.04.2007, at 23:00, Pedro Alves wrote:

bernhard wrote:

I was able to build a gcc toolchain (mingw32ce and cegcc) on my   
MacOSX to do cross-compiling,
  

Interesting, so you were able to build it.  For the archives, could
you explain what was going wrong before, and how you solved it?



Of course!
It was not really hard to get it going. The first problem i ran into  
was that on my OSX box the 'readlink -f .' would not do the obvious.  
I replaced it with `pwd`:
  


I also decided to use another prefix dir, but that is not really  
important. I made this changes in "build-mingw32ce.sh" and in "build- 
cegcc.sh".




Thanks!  I was going to apply your pwd fix, but ended up rewriting
the whole build-mingw32ce.sh options logic (shamelessly
copying it from what autoconf generates, and then tweaking
it).  The result is attached.  Would be great if you could
give it a spin on MacOS.

It now builds wherever pwd is, and doesn't automatically create
a build-ming32ce subdir.  You can now pass a list of comma
separated components to build, instead of just one.

So to use it, you now do:
mkdir $any_build_dir
cd $any_build_dir
$path_to_src/build-mingw32ce.sh --prefix=/I_put_by_toolchains_here/mingw32ce


   >../build-mingw32ce.sh --help

build-mingw32ce.sh builds the mingw32ce toolchain.

Usage: ../build-mingw32ce.sh [OPTIONS] ...

 -h, --help  print this help, then exit
 --prefix=PREFIX install toolchain in PREFIX
 [/opt/mingw32ce]
 --components=LIST   specify which components to build
 valid components are:
 all,binutils,gcc,w32api,mingw,
 gdb,gdbstub,docs and profile
 [all]

Report bugs to 



Should be easier and more intuitive to set a different prefix without
hacking the script.

If anyone has any spare cycles, would be great to have
usage reports on this new script.

After that changes i was able to start both build scripts without  
parameters. Unfortunately gdb does not build using "build-mingw32ce.sh":
.../cegcc/src/gdb/gdb/exceptions.h:165: error: parse error before  
‘va_list’

make[2]: *** [gdb.o] Error 1
make[1]: *** [all-gdb] Error 2
make: *** [all] Error 2

"build-cegcc.sh" runs *perfectly*well* without any complaints!!!

  


Strange, there shouldn't be any difference.  The gdb in our svn is a
huge hack, and I am frankly surprised that it built at all for
you (you're on x86, right?).  Current gdb-cvs has rewritten
WinCE support, and should build cleanly for everyone.
Still waiting for the mingw32ce name to be made official
at config-patches to finally get rid of our hacky version.

I'll post a bit of usage instructions for the gdb-cvs version on a
separate thread.

Cheers,
Pedro Alves




#!/bin/sh

BASE_DIRECTORY=`dirname $0`
BASE_DIRECTORY=`(cd ${BASE_DIRECTORY}; pwd)`
ME=`basename $0`

#
# Initializations.
#
ac_default_prefix="/opt/mingw32ce"
export BUILD_DIR=`pwd`

function usage
{
cat << _ACEOF

$ME builds the mingw32ce toolchain.

Usage: $0 [OPTIONS] ...

  -h, --help  print this help, then exit
  --prefix=PREFIX install toolchain in PREFIX
  [$ac_default_prefix]
  --components=LIST   specify which components to build
  valid components are: all,binutils,gcc,w32api,mingw,
  gdb,gdbstub,docs and profile
  [all]

Report bugs to .
_ACEOF

}

ac_prev=
for ac_option
do
  # If the previous option needs an argument, assign it.
  if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
  fi

  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`

  case $ac_option in

  -help | --help | --hel | --he | -h)
usage; exit 0 ;;

  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;

  -components | --components | --component | --componen | \
  --compone | --compon | --compo | --comp | --com \
  | --co | --c)
ac_prev=components ;;
  -components=* | --components=* | --component=* | --componen=* \
  | --compone=* | --compon=* | --compo=* | --comp=* | --com=* \
  | --co=* | --c=*)
components=$ac_optarg ;;

  -*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
   { (exit 1); exit 1; }; }
;;

  *=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
  { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
   { (exit 1); exit 1; }; }
ac_optarg=`echo "$ac_optarg" | sed "s/'/'''/g"`
eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;

  *)
;;
  esac
done

if test -n "$ac_prev"; then
  ac_option=--`

Re: [Cegcc-devel] Mysterious crash in my application

2007-04-25 Thread Pedro Alves
Danny Backx escreveu:
> As usually happens, you write a report, send it, then find something :-)
> 
> The offending statement was indeed wrong, the variables weren't ints (as
> the %d would expect) but doubles. Changing the format into %f fixes the
> crash.
> 

Probably the %s format got a broken string pointer
due to a mismatch between the way the params where
passed on the stack, and what printf was expecting due
to the formatters you've passed in (%d).  When it tried
to print the string, it probably derefenced a broken
pointer, hence the crash.

> Next question now is why I none of the tools available help me in
> detecting the problem. I've tried to reproduce this in a small program,
> haven't succeeded yet.


Try using the gcc format attribute on your Log
function to have a wrong format/param warning
like you have for printf.

Cheers,
Pedro Alves

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel


Re: [Cegcc-devel] New gdb support in gdb cvs head.

2007-04-25 Thread Pedro Alves

Pedro Alves wrote:

Hi all,

The new gdb support based on gdbserver is now installed
into gdb cvs head at http://sourceware.org/gdb/

To build it, you will need a little patch, so configure
accepts the arm-wince-mingw32ce target.  I'm waiting
for autoconf folks to accept the mingw32ce target name,
so I can commit that patch, but in the meantime, if anyone
wants to test it, let me know, and I'll guide you.  Particularly
interesting would be to hear from people with 64bit machines
that can't build the gdb in our svn.



Someone asked me about this privately.

Attached is the small patch needed to be able to build it.
Apply it to gdb-cvs/src/bfd

* build gdb with:

mkdir buildgdb
cd buildgdb
$(PATH_TO_GDB_SOURCES)/src/gdb/configure \
 --target=arm-wince-mingw32ce \
 --prefix=/opt/mingw32ce
make && make install

* and gdbserver with:

mkdir buildgdbserver
cd buildgdbserver

$(PATH_TO_GDB_SOURCES)/src/gdb/gdbserver/configure \
   --host=arm-wince-mingw32ce \
   --target=arm-wince-mingw32ce \
   --prefix=/opt/mingw32ce

make && make install

* copy built gdbserver.exe to the device.
eg: copy it to \tmp\gdbserver.exe

* copy the program you want to debug to the device.  You
can also strip it first with arm-wince-mingw32ce-strip before
copying to safe both space on the device and copy time.

eg: copy it to \tmp\main.exe

* run gdbserver on the device like so:

gdbserver : /tmp/main.exe

 is the tcp port gdbserver opens for communication
with gdb. You can use whichever you like.  I just find
 easy to type.

start arm-wince-mingw32ce-gdb like so:
arm-wince-mingw32ce-gdb main.exe

* connect to the gdbserver:

gdb> target remote :

gdb should connect to gdbserver, and
the main.exe program is stopped at the entry point.

* Put a break in main:
gdb> b main

issue a continue (1):
gdb> cont

Debug as usual.

(1) When you connect to a remote target, the target is
already running, so you don't issue a run, but a
continue.  That is not WinCE specific, but a
consequence of how gdb/remote is designed.

Since gdb<->gdbserver uses normal tcp communication, it
doesn't depend on Activesync for anything.  Of course,
to do the gdbserver.exe and main.exe uploading you could use
Activesync or Synce.  You can also copy the files using
a flash card reader/writer as well.

Cheers,
Pedro Alves



	* config.bfd (arm-wince-mingw32ce*): Add bfd target.
---
 config.bfd |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: bfd/config.bfd
===
--- bfd.orig/config.bfd	2007-03-14 21:30:46.0 +
+++ bfd/config.bfd	2007-04-25 19:30:50.0 +0100
@@ -231,7 +231,7 @@ case "${targ}" in
 targ_underscore=no
 targ_cflags=-DARM_COFF_BUGFIX
 ;;
-  arm-wince-pe | arm-*-wince)
+  arm-wince-pe | arm-wince-mingw32ce*)
 targ_defvec=arm_wince_pe_little_vec
 targ_selvecs="arm_wince_pe_little_vec arm_wince_pe_big_vec arm_wince_pei_little_vec arm_wince_pei_big_vec"
 targ_underscore=no


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel


Re: [Cegcc-devel] Mysterious crash in my application

2007-04-25 Thread Danny Backx
On Wed, 2007-04-25 at 19:21 +0100, Pedro Alves wrote:
> Danny Backx escreveu:
> > Next question now is why I none of the tools available help me in
> > detecting the problem. I've tried to reproduce this in a small program,
> > haven't succeeded yet.
> 
> 
> Try using the gcc format attribute on your Log
> function to have a wrong format/param warning
> like you have for printf.

I didn't know how that worked, I do now. Thanks for the pointer.

My Log function is now defined as
void Log(int level, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));

and with the -Wall argument, the compiler detects the problem.

Danny
-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info


signature.asc
Description: This is a digitally signed message part
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel