Jump to content
IGNORED

GCC for the TI


insomnia

Recommended Posts

Hi Thom,

 

Which version of the GCC patch do you have? There was a bug fixed a while ago that had to do with shifts and that appears to be the case here. Assuming the padWord type is signed, you have a right-shift that is getting compiled to a left-shift, exactly the same bug.

 


{
  if (theKey >> 7!=0)
    {

        mov  r1, r9
        sla  r1, >7

  • Like 2
Link to comment
Share on other sites

ARGH!

make[4]: Entering directory '/home/thomc/gcc-ti/build/binutils-2.19.1/bfd/doc'
gcc -o chew.$$ -g -O2  \
   -I.. -I../.././bfd/doc/.. -I../.././bfd/doc/../../include -I../.././bfd/doc/../../intl -I../../intl ../.././bfd/doc/chew.c; \
/bin/bash ../.././bfd/doc/../../move-if-change chew.$$ chew
../.././bfd/doc/chew.c: In function ‘print_stack_level’:
../.././bfd/doc/chew.c:479:51: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
   fprintf (stderr, "current string stack depth = %d, ", tos - stack);
                                                  ~^     ~~~~~~~~~~~
                                                  %ld
../.././bfd/doc/chew.c:480:52: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
   fprintf (stderr, "current integer stack depth = %d\n", isp - istack);
                                                   ~^     ~~~~~~~~~~~~
                                                   %ld
../.././bfd/doc/chew.c: In function ‘main’:
../.././bfd/doc/chew.c:1566:61: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
       fprintf (stderr, "finishing with current stack level %d\n",
                                                            ~^
                                                            %ld
         tos - stack);
         ~~~~~~~~~~~
make[4]: Leaving directory '/home/thomc/gcc-ti/build/binutils-2.19.1/bfd/doc'
./chew -f ../.././bfd/doc/doc.str <../.././bfd/doc/../targets.c >targets.tmp
/bin/bash ../.././bfd/doc/../../move-if-change targets.tmp targets.texi
restore=: && backupdir=".am$$" && \
rm -rf $backupdir && mkdir $backupdir && \
if (makeinfo --split-size=5000000 --split-size=5000000 --version) >/dev/null 2>&1; then \
  for f in bfd.info bfd.info-[0-9] bfd.info-[0-9][0-9] bfd.i[0-9] bfd.i[0-9][0-9]; do \
    if test -f $f; then mv $f $backupdir; restore=mv; else :; fi; \
  done; \
else :; fi && \
if makeinfo --split-size=5000000 --split-size=5000000   -I ../.././bfd/doc \
 -o bfd.info `test -f 'bfd.texinfo' || echo '../.././bfd/doc/'`bfd.texinfo; \
then \
  rc=0; \
else \
  rc=$?; \
  $restore $backupdir/* `echo "./bfd.info" | sed 's|[^/]*$||'`; \
fi; \
rm -rf $backupdir; exit $rc
./elf.texi:11: raising the section level of @subsubsection which is too low
Makefile:394: recipe for target 'bfd.info' failed
make[3]: *** [bfd.info] Error 1
make[3]: Leaving directory '/home/thomc/gcc-ti/build/binutils-2.19.1/bfd/doc'
Making info in po
make[3]: Entering directory '/home/thomc/gcc-ti/build/binutils-2.19.1/bfd/po'
( if test 'x../.././bfd/po' != 'x.'; then \
    posrcprefix='../.././bfd/'; \
  else \
    posrcprefix="../"; \
  fi; \
  rm -f SRC-POTFILES-t SRC-POTFILES \
    && (sed -e '/^#/d' \
            -e '/^[     ]*$/d' \
            -e "s@.*@   $posrcprefix& \\\\@" < ../.././bfd/po/SRC-POTFILES.in \
        | sed -e '$s/\\$//') > SRC-POTFILES-t \
    && chmod a-w SRC-POTFILES-t \
    && mv SRC-POTFILES-t SRC-POTFILES )
( rm -f BLD-POTFILES-t BLD-POTFILES \
    && (sed -e '/^#/d' \
            -e '/^[     ]*$/d' \
            -e "s@.*@   ../& \\\\@" < ../.././bfd/po/BLD-POTFILES.in \
        | sed -e '$s/\\$//') > BLD-POTFILES-t \
    && chmod a-w BLD-POTFILES-t \
    && mv BLD-POTFILES-t BLD-POTFILES )
cd .. \
  && CONFIG_FILES=po/Makefile.in:po/Make-in \
     CONFIG_HEADERS= /bin/bash ./config.status
config.status: creating po/Makefile.in
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
config.status: executing bfd_stdint.h commands
config.status: executing default commands
make[3]: Nothing to be done for 'info'.
make[3]: Leaving directory '/home/thomc/gcc-ti/build/binutils-2.19.1/bfd/po'
make[3]: Entering directory '/home/thomc/gcc-ti/build/binutils-2.19.1/bfd'
make[3]: Nothing to be done for 'info-am'.
make[3]: Leaving directory '/home/thomc/gcc-ti/build/binutils-2.19.1/bfd'
Makefile:1094: recipe for target 'info-recursive' failed
make[2]: *** [info-recursive] Error 1
make[2]: Leaving directory '/home/thomc/gcc-ti/build/binutils-2.19.1/bfd'
Makefile:3094: recipe for target 'all-bfd' failed
make[1]: *** [all-bfd] Error 2
make[1]: Leaving directory '/home/thomc/gcc-ti/build/binutils-2.19.1'
Makefile:716: recipe for target 'all' failed
make: *** [all] Error 2
=== Failed to build Binutils ===

-Thom

Link to comment
Share on other sites

  • 3 weeks later...

Hi everyone!

What the exact installation steps?

I see multiple patches for gcc and binutils. Do I need to apply all those patches or just the latest ones?

It seems gcc patches are about a specific gcc version but which versions are the binutils supposed to patch?

 

Last time I tried the compilation was impossible under Cygwin 64-bit. Is the compilation now possible?

Regards

 

Fabrizio

Link to comment
Share on other sites

I'm also trying to compile gcc for the TI 99 right now.

 

This this I downloaded the latest versions from Insomialabs, and I'm trying to apply the instructions at the beginning of this thread.

 

After I untarred the binutils, I tried to apply the patch using -p1 (option -1 is not understood by my patch version), getting this:

.

arcturus ~/ti99/gcc/binutils > patch -p1 < ../binutils-2.19.1-tms9900-1.7.patch 
patching file bfd/archures.c
Reversed (or previously applied) patch detected!  Assume -R? [n]

.

-R doesn't make sense, since the files haven't been swapped. Saying Y also doesn't produce a valid configuration.

.

arcturus ~/ti99/gcc/binutils > patch -p1 < ../binutils-2.19.1-tms9900-1.7.patch  
patching file bfd/archures.c
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 FAILED at 407.
Hunk #2 FAILED at 501.
Hunk #3 FAILED at 570.
3 out of 3 hunks FAILED -- saving rejects to file bfd/archures.c.rej
...

.

So that doesn't work either.

 

I also downgraded my patch to 2004, which is one year before GCC 4.4.0 was released. But still, -1 is not recognized, and I get the same result as above.

 

What am I missing here? Do I need the original binutils sources as well?

 

Link to comment
Share on other sites

What the exact installation steps?

 

I see multiple patches for gcc and binutils. Do I need to apply all those patches or just the latest ones?

 

It seems gcc patches are about a specific gcc version but which versions are the binutils supposed to patch?

 

Last time I tried the compilation was impossible under Cygwin 64-bit. Is the compilation now possible?

 

There is an archive file inside the first post in this thread called "gcc-installer.tar.gz". It contains a bash script that contains the "exact steps". The bash script downloads the proper gcc and binutils versions, and applies the patches. The needed patch files are in the archive as well.

 

If you are trying to do it manually, you can figure out the versions of gcc/ binutils needed from the patch file names:

 

binutils-2.19.1-tms9900-1.7.patch

gcc-4.4.0-tms9900-1.18.patch

 

The first patch file above has a name which indicates it requires binutils version 2.19.1. Likewise, the second patch file requires gcc version 4.4.0.

 

As for Cygwin - sorry I have no idea.

  • Like 1
Link to comment
Share on other sites

And how do I actually compile a C program?

.

arcturus ~/ti99/gcc > tms9900-gcc testprog.c -I libc99/include/ -std=c99 -Llibc99
/home/ralph/ti99/bin/lib/gcc/tms9900/4.4.0/../../../../tms9900/bin/ld: cannot fi
nd -lgcc
collect2: ld returned 1 exit status

.

I searched my GCC hierarchy, but cannot find this library. I only have a directory called ti99/bin/lib/gcc/tms9900/4.4.0/, but this contains only include files.

Link to comment
Share on other sites

And how do I actually compile a C program?

.

arcturus ~/ti99/gcc > tms9900-gcc testprog.c -I libc99/include/ -std=c99 -Llibc99
/home/ralph/ti99/bin/lib/gcc/tms9900/4.4.0/../../../../tms9900/bin/ld: cannot fi
nd -lgcc
collect2: ld returned 1 exit status

.

I searched my GCC hierarchy, but cannot find this library. I only have a directory called ti99/bin/lib/gcc/tms9900/4.4.0/, but this contains only include files.

 

Could you post your testprog.c?

Link to comment
Share on other sites

Ralph, I get the same error when I run your build command. I know for sure that my GCC environment builds. I've had better luck using a makefile - you can find examples of these in the samples in the first post of this thread. Those samples are however, geared towards building binaries that are run from the TI Cartridge ROM space.

 

I can dig into it a little more later, I just don't have the time now.

Edited by chue
Link to comment
Share on other sites

Meanwhile I found libgcc, it was still in the build directory, but didn't get copied to the installation dir, probably because of the build error for libssp.

 

For a simple program

.

#include <stdio.h> 

int main()
{
 printf("Hello world!");
 return 0;
}

.

I've now arrived at

.

/home/ralph/ti99/bin/lib/gcc/tms9900/4.4.0/../../../../tms9900/bin/ld: warning: 
cannot find entry symbol _start; defaulting to 000000000000a074
libc99/libc.a(stdout.o): In function `stdout_rec':
(.data+0x4): undefined reference to `console_write'
collect2: ld returned 1 exit status

.

Does stdio actually work for the TI 99? How can I specify the AORG for the code? Can I also get other formats than EA5?

.

Link to comment
Share on other sites

Under Cygwin 32-bit I get:
config.status: creating po/Makefile.in
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
config.status: executing bfd_stdint.h commands
config.status: executing default commands
make[3]: Nothing to be done for 'info'.
make[3]: Leaving directory '/cygdrive/c/Retro/gcc-installer/build/binutils-2.19.1/bfd/po'
make[3]: Entering directory '/cygdrive/c/Retro/gcc-installer/build/binutils-2.19.1/bfd'
make[3]: Nothing to be done for 'info-am'.
make[3]: Leaving directory '/cygdrive/c/Retro/gcc-installer/build/binutils-2.19.1/bfd'
make[2]: *** [Makefile:1094: info-recursive] Error 1
make[2]: Leaving directory '/cygdrive/c/Retro/gcc-installer/build/binutils-2.19.1/bfd'
make[1]: *** [Makefile:3100: all-bfd] Error 2
make[1]: Leaving directory '/cygdrive/c/Retro/gcc-installer/build/binutils-2.19.1'
make: *** [Makefile:723: all] Error 2
=== Failed to build Binutils ===

How can I fix this problem?

Link to comment
Share on other sites

Does stdio actually work for the TI 99? How can I specify the AORG for the code? Can I also get other formats than EA5?

.

 

No, neither stdio nor stdlib are implemented. You will have to use Tursi's libti99, which has a usable printf.

 

AORG - is this the location where the code resides when running? If so then you can specify it with a linker file. Again, see the samples in the first post. Some of those will specify >6000, as they are in the cart space. Data generally resides in 32k expansion at >A000.

 

As for formats other than EA5, I am unsure. The only one that I use is a straight "bin" which targets the cart ROM space.

Edited by chue
  • Like 1
Link to comment
Share on other sites

Thank, chue!

 

I thought that the libc99 library from Insomnia Labs, which includes stdio, was actually a working implementation. I now see that it's an "initial version", where putchar still writes to a file. I'll use Tursi's library then.

 

As for formats, raw bin is my preferred type. :)

Link to comment
Share on other sites

What are the preconditions to run the installer?

The installer fails both on Cygwin 32 bit (64 bit ) and on native Linux Lubuntu 64-bit:
...
Makefile:394: recipe for target 'bfd.info' failed
make[3]: *** [bfd.info] Error 1
make[3]: Leaving directory '/home/brizio/installer_gcc_ti99/build/binutils-2.19.1/bfd/doc'
Making info in po
make[3]: Entering directory '/home/brizio/installer_gcc_ti99/build/binutils-2.19.1/bfd/po'
( if test 'x../.././bfd/po' != 'x.'; then \
posrcprefix='../.././bfd/'; \
else \
posrcprefix="../"; \
fi; \
rm -f SRC-POTFILES-t SRC-POTFILES \
&& (sed -e '/^#/d' \
-e '/^[ ]*$/d' \
-e "s@.*@ $posrcprefix& \\\\@" < ../.././bfd/po/SRC-POTFILES.in \
| sed -e '$s/\\$//') > SRC-POTFILES-t \
&& chmod a-w SRC-POTFILES-t \
&& mv SRC-POTFILES-t SRC-POTFILES )
( rm -f BLD-POTFILES-t BLD-POTFILES \
&& (sed -e '/^#/d' \
-e '/^[ ]*$/d' \
-e "s@.*@ ../& \\\\@" < ../.././bfd/po/BLD-POTFILES.in \
| sed -e '$s/\\$//') > BLD-POTFILES-t \
&& chmod a-w BLD-POTFILES-t \
&& mv BLD-POTFILES-t BLD-POTFILES )
cd .. \
&& CONFIG_FILES=po/Makefile.in:po/Make-in \
CONFIG_HEADERS= /bin/bash ./config.status
config.status: creating po/Makefile.in
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
config.status: executing bfd_stdint.h commands
config.status: executing default commands
make[3]: Nothing to be done for 'info'.
make[3]: Leaving directory '/home/brizio/installer_gcc_ti99/build/binutils-2.19.1/bfd/po'
make[3]: Entering directory '/home/brizio/installer_gcc_ti99/build/binutils-2.19.1/bfd'
make[3]: Nothing to be done for 'info-am'.
make[3]: Leaving directory '/home/brizio/installer_gcc_ti99/build/binutils-2.19.1/bfd'
Makefile:1094: recipe for target 'info-recursive' failed
make[2]: *** [info-recursive] Error 1
make[2]: Leaving directory '/home/brizio/installer_gcc_ti99/build/binutils-2.19.1/bfd'
Makefile:3094: recipe for target 'all-bfd' failed
make[1]: *** [all-bfd] Error 2
make[1]: Leaving directory '/home/brizio/installer_gcc_ti99/build/binutils-2.19.1'
Makefile:716: recipe for target 'all' failed
make: *** [all] Error 2
=== Failed to build Binutils ===

Link to comment
Share on other sites

Indeed export MAKEINFO=missing does help to move further. Could someone please make this information available on the first page?

With this export I get to compile most of it but it fails with:
make[3]: Entering directory '/home/brizio/installer_gcc_ti99/build/gcc-4.4.0/build/libiberty/testsuite'
make[3]: Nothing to be done for 'install'.
make[3]: Leaving directory '/home/brizio/installer_gcc_ti99/build/gcc-4.4.0/build/libiberty/testsuite'
make[2]: Leaving directory '/home/brizio/installer_gcc_ti99/build/gcc-4.4.0/build/libiberty'
/bin/bash: line 3: cd: tms9900/libstdc++-v3: No such file or directory
Makefile:10623: recipe for target 'install-target-libstdc++-v3' failed
make[1]: *** [install-target-libstdc++-v3] Error 1
make[1]: Leaving directory '/home/brizio/installer_gcc_ti99/build/gcc-4.4.0/build'
Makefile:2475: recipe for target 'install' failed
make: *** [install] Error 2
=== Installation complete ===



Does anyone know how to fix this?

Link to comment
Share on other sites

Indeed export MAKEINFO=missing does help to move further. Could someone please make this information available on the first page?

 

With this export I get to compile most of it but it fails with:

 

/bin/bash: line 3: cd: tms9900/libstdc++-v3: No such file or directory

 

Does anyone know how to fix this?

 

I think you are close to solving it.. see my post here:

 

http://atariage.com/forums/topic/164295-gcc-for-the-ti/?p=3885112

Link to comment
Share on other sites

I use an edited version of the install.sh script that looks like this:

# Super simple patch and install script for GCC and Binutils

# Base all following work on latest patch versions
BINUTILS_PATCH=`tree -ivL 1 . | grep binutils.*.patch | tail -1`
GCC_PATCH=`     tree -ivL 1 . | grep gcc.*.patch      | tail -1`

# Extract tool versions from patch name
BINUTILS_VERSION=`echo $BINUTILS_PATCH | sed "s/-tms9900.*//"`
GCC_VERSION=`     echo $GCC_PATCH      | sed "s/-tms9900.*//"`

# Compose name of source archive
BINUTILS_ARCHIVE="$BINUTILS_VERSION.tar.bz2"
GCC_ARCHIVE="$GCC_VERSION.tar.gz"

# Select download tool
if [ ! -z "`which wget`" ]; then
  WGET="wget "
elif [ ! -z "`which curl`" ]; then
  WGET="curl -O --retry 999 --retry-max-time 0 -C -"
fi


# Print error text if last command failed
check_result ()
{
  if [ ! $? == 0 ] ; then
    echo $1
    exit
  fi
}

# Check arguments
PREFIX=$1
if [ -z $PREFIX ] ; then
   echo Error: No output directory specified
   echo
   echo Usage:
   echo   install.sh DIRECTORY
   echo The output binaries willl be installed at DIRECTORY/bin
   exit
fi

echo "Using these patches:"
echo "    $BINUTILS_PATCH"
echo "    $GCC_PATCH"
echo

echo "=== Creating output directory ==="
if [ ! -d $PREFIX ] ; then
  mkdir -p $PREFIX
  check_result "=== Failed to create output directory ==="
fi

START=`pwd`
PREFIX=`cd $PREFIX; pwd`

echo "=== Getting Binutils sources ==="
if [ ! -f $BINUTILS_ARCHIVE ] ; then
  $WGET http://ftp.gnu.org/gnu/binutils/$BINUTILS_ARCHIVE
  check_result "=== Failed to get Binutils sources ==="
fi

echo "=== Getting GCC sources ==="
if [ ! -f $GCC_ARCHIVE ] ; then
  $WGET http://ftp.gnu.org/gnu/gcc/$GCC_VERSION/$GCC_ARCHIVE
  check_result "=== Failed to get GCC sources ==="
fi

echo "=== Make build directory ==="
if [ ! -d build ] ; then
  mkdir build
  check_result "=== Failed to create build directory ==="
fi
cd build

echo "=== Decompressing and patching Binutils sources ==="
if [ ! -d $BINUTILS_VERSION ] ; then
   bunzip2 -c ../$BINUTILS_ARCHIVE > binutils.tar && tar -xf binutils.tar && rm binutils.tar
   check_result "=== Failed to decompress Binutils sources ==="
fi
if [ ! -f .binutils_patched ] ; then
   cd $BINUTILS_VERSION
   patch -p1 < ../../$BINUTILS_PATCH
   check_result "=== Failed to patch Binutils sources ==="
   cd ..
   touch .binutils_patched
fi

echo "=== Decompressing and patching GCC sources ==="
if [ ! -d $GCC_VERSION ] ; then
   tar -xzf ../$GCC_ARCHIVE -C .
   check_result "=== Failed to decompress GCC sources ==="
fi
if [ ! -f .gcc_patched ] ; then
   cd $GCC_VERSION
   patch -p1 < ../../$GCC_PATCH
   check_result "=== Failed to patch GCC sources ==="
   cd ..
   touch .gcc_patched
fi

echo "=== Building Binutils ==="
if [ ! -f .binutils_built ] ; then
   cd $BINUTILS_VERSION
   ./configure --target tms9900 --prefix $PREFIX --disable-build-warnings
   check_result "=== Failed to configure Binutils ==="
   make all
   check_result "=== Failed to build Binutils ==="
   make install
   check_result "=== Failed to install Binutils ==="
   cd ..
   touch .binutils_built
fi

echo "=== Building GCC ==="
if [ ! -f .gcc_built ] ; then
   cd $GCC_VERSION
   mkdir build
   cd build
   ../configure --prefix $PREFIX --target=tms9900 --enable-languages=c
   check_result "=== Failed to configure GCC ==="
#   make all-gcc all-target-libgcc
   make all-gcc
   check_result "=== Failed to build GCC ==="
   make install
   # Make install has an expected failure:
   #  /bin/bash: line 3: cd: tms9900/libssp: No such file or directory
   # We do not build libssp, so that's OK
   cd ../..
   touch .gcc_built
fi

echo === Installation complete ===
cd $START


This doesn't build c++ (which seems to cause issues for Fabrizio) or libgcc, but I don't need those anyway. This works for me on Mac and Linux

Link to comment
Share on other sites

Does stdio actually work for the TI 99? How can I specify the AORG for the code? Can I also get other formats than EA5?

 

I use linker scripts for my stuff, but I only create cart images (although EA5 format is just a flat binary chopped up in 8k chunks, so it should be easy enough to do with linker scripts and some creative use of cut as well).

 

The following is my linker script for bank switching binaries. It's a bit convoluted, but it automatically adds binary resource to the image and facilitates the bankswitching scheme I'm using. Maybe it's useful for you.

/* Linker script to create TI99/4A cartridges */

/* Output straight to a flat binary format (i.e. not ELF) */
OUTPUT_FORMAT(binary)
OUTPUT(cartridge.bin)

/* TI memory layout */
MEMORY
{
	cart_rom (rx) : ORIGIN = 0x6000, LENGTH = 0x2000 /* cartridge ROM, read-only */
	lower_exp (wx) : ORIGIN = 0x2000, LENGTH = 0x2000 /* 8k, not minus 128b */
	higher_exp (wx) : ORIGIN = 0xa000, LENGTH = 0x6000
	scratchpad (wx) : ORIGIN = 0x8342, LENGTH = 0x00bd /* 32b is for gcc workspace, 34b for audio player workspace */
}

/* Where we put sections */
SECTIONS
{
	. = 0x6000;

	.header0 : 
	{ 
		bank0/cart_header.o(.text) 
	} >cart_rom						
	
	_persistent_src = 0x6000 + SIZEOF(.header0);
	
	.persistent	: AT ( _persistent_src ) 
	{ 
		_persistent = . ; 
		persistent/*.o(.text); 
		_persistent_end = . ;
	} >lower_exp

	.bank0 (LOADADDR(.persistent) + SIZEOF( .persistent )) : 
	{ 
		_text = . ; 
		bank0/*.o(.text); 
		_text_end = . ;
	}

	_scratchpad_src = .;

	.scratchpad	0x8342	: AT ( _text_end ) 
	{ 
		_scratchpad = . ; 
		scratchpad/*.o(.text); 
		_scratchpad_end = . ;
	}

	.header1 0x6000    	: AT ( 0x8000 ) 
	{ 
		bank1/cart_header.o(.text) 
	}	

	.bank1 0x6022   	: AT ( 0x8022 ) 
	{ 
		bank1/*.o(.text); 
	}
	
	.header2 0x6000    	: AT ( 0xa000 ) 
	{ 
		bank2/cart_header.o(.text) 
	}	
	
	.bank2 0x6022    	: AT ( 0xa022 ) 
	{ 
		bank2/*.o(.text); 
	}
	
	.header3 0x6000    	: AT ( 0xc000 ) 
	{ 
		bank3/cart_header.o(.text) 
	}	
	
	.bank3 0x6022    	: AT ( 0xc022 ) 
	{ 
		bank3/*.o(.text); 
	}
	
	.data  0xa000    	: AT ( 0xe000 ) 
	{
		_data = . ; 
		persistent/*.o( .data ) bank0/*.o( .data ) bank1/*.o( .data ) bank2/*.o( .data ) bank3/*.o( .data ); 
		_data_end = . ;
	}
	
	.binary	0x0000   	: AT ( 0x10000 ) 
	{ 
		resources/*.o( .data ); 
	}
	
	.bss (_data_end) 	: AT ( 0x80000) 
	{ 
		_bss = . ; 
		persistent/*.o( .bss ) bank0/*.o( .bss ) bank1/*.o( .bss ) bank2/*.o( .bss ) bank3/*.o( .bss ); 
		_bss_end = . ;
	}

	.fill  0x83fff   	: AT ( 0x83fff) 
	{ 
		BYTE(0x00); 
	}	/* Pad to 504kb, 8k less than full image size */
	
	.headerend 0x6000	: AT ( 0x84000) 
	{ 
		bankx/cart_header.o(.text) 
	}
	
	.fill2  0x85fff   	: AT ( 0x85fff) 
	{ 
		BYTE(0x00); 
	}	/* Pad to 512kb, change this to your flash size */
}

/* Ensure banks don't call each other's functions directly */
NOCROSSREFS( .bank0 .bank1 .bank2 .bank3)

  • Like 2
Link to comment
Share on other sites

 

The following is my linker script for bank switching binaries. It's a bit convoluted, but it automatically adds binary resource to the image and facilitates the bankswitching scheme I'm using. Maybe it's useful for you.

 

Yes indeed, thank you! It still boggles my mind to see TI stuff applied to C compilation and linking. :) So I guess mixing C and assembly works just right out of the box?

  • Like 1
Link to comment
Share on other sites

In researching this, I was just amazed at how powerful linker scripts really can be for a platform like this. The beautiful thing is that without the need for any binary tools at all gcc can create binaries that just work on the ti...

 

Yup, embedded assembly works just fine, as do pure assembly files (although I do think the gcc assembler syntax is slightly different from the EA5 syntax. Not sure how it compares to your toolchain either)

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...