Today is my first shot at programming a calculator, and it's not been a perfectly smooth process.

I'm on Arch Linux, and have successfully compiled cross-sh3eb-elf-binutils, cross-sh3eb-elf-gcc, mkg3a from the AUR.

sh3eb seems to be in /usr/bin, as indicated here:

Code:

[nathan@gerty Hello_World]$ locate sh3eb
/usr/bin/sh3eb-elf-addr2line
/usr/bin/sh3eb-elf-ar
/usr/bin/sh3eb-elf-as
/usr/bin/sh3eb-elf-c++
/usr/bin/sh3eb-elf-c++filt
/usr/bin/sh3eb-elf-cpp
/usr/bin/sh3eb-elf-elfedit
/usr/bin/sh3eb-elf-g++
/usr/bin/sh3eb-elf-gcc
/usr/bin/sh3eb-elf-gcc-4.7.0
/usr/bin/sh3eb-elf-gcc-ar
/usr/bin/sh3eb-elf-gcc-nm
/usr/bin/sh3eb-elf-gcc-ranlib
/usr/bin/sh3eb-elf-gcov
/usr/bin/sh3eb-elf-gprof
/usr/bin/sh3eb-elf-ld
/usr/bin/sh3eb-elf-ld.bfd
/usr/bin/sh3eb-elf-nm
/usr/bin/sh3eb-elf-objcopy
/usr/bin/sh3eb-elf-objdump
/usr/bin/sh3eb-elf-ranlib
/usr/bin/sh3eb-elf-readelf
/usr/bin/sh3eb-elf-size
/usr/bin/sh3eb-elf-strings
/usr/bin/sh3eb-elf-strip

so I modified prizm_rules like so:

Code:
PREFIX := /usr/bin/sh3eb-elf-


I then proceeded to try to compile the Hello World, courtesy of Zeldaking. I copied the example project over to projects/Hello_World/, made the Hello_World in src/ and pasted the code in. I then ran make, which gave me a pretty weird error.

Quote:

[nathan@gerty Hello_World]$ make
/usr/bin/sh3eb-elf-gcc -mb -m4a-nofpu -mhitachi -nostdlib -T/home/nathan/code/PrizmSDK-0.3/common/prizm.ld -Wl,-static -Wl,-gc-sections -L/home/nathan/code/PrizmSDK-0.3/lib -lfxcg -lgcc -o /home/nathan/code/PrizmSDK-0.3/projects/Hello_World/Hello_World.bin
/home/nathan/code/PrizmSDK-0.3/lib/libfxcg.a(crt0.o): In function `main':
(.pretext+0x50): undefined reference to `_main'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/nathan/code/PrizmSDK-0.3/projects/Hello_World/Hello_World.bin] Error 1
make: *** [build] Error 2


Anyone have any clue where I went wrong?
There don't appear to be any source files in your project, so there's nothing to build. You might note that gcc isn't getting any input files.

Personally, I'm not a fan of the "automagic" Makefile, and prefer to use to something like the following:
Code:
CC=sh3eb-elf-gcc
MKG3A=mkg3a
RM=rm
CFLAGS=-m4a-nofpu -mb -Os -mhitachi -Wall -I../include -lgcc -L../lib
LDFLAGS=$(CFLAGS) -nostartfiles -T../toolchain/prizm.x -Wl,-static -Wl,-gc-sections
CSOURCES=src/example.c
OBJECTS=src/example.o
BIN=Example.bin
ADDIN=$(BIN:.bin=.g3a)
 
all: $(ADDIN)
 
$(BIN): $(OBJECTS)
$(CC) $< $(LDFLAGS) -o $@
 
$(ADDIN): $(BIN)
$(MKG3A) -n :Example $< $@
 
.s.o:
$(CC) -c $(CFLAGS) $< -o $@
 
.c.o:
$(CC) -c $(CFLAGS) $< -o $@
 
clean:
$(RM) $(addprefix $(OUTDIR)\,$(OBJECTS)) $(BIN) $(ADDIN)
I'd like to overhaul the distribution Makefile to be a bit cleaner than it is at some point, but that's way down on my priorities.

Nice to see that somebody is getting use out of my PKGBUILDs, too.
I got it working. I had just typoed in my make file and I overlooked it when I checked it to see if I made any mistakes.

Tari wrote:
Nice to see that somebody is getting use out of my PKGBUILDs, too.

Absolutely glad it was there. It made it so easy. Thanks for taking the time on getting the PKGBUILD set up.
I'm glad to see that this was an easy fix. Thanks for being on top of everything, Tari, especially considering that you don't (?) have the calculator in question.
Tari has a Prizm, where have you been Kerm? He's also done way more work on the Prizm SDK than I have at this point. Razz
KermMartian wrote:
Thanks for being on top of everything, Tari, especially considering that you don't (?) have the calculator in question.
I have one, I just don't actually use it much (what can I say, I'm too lazy to debug things on hardware?).

(I see Jonimus beat me to this response. It gets to stay here anyway.)
Jonimus: Well, I know that both you and Tari didn't have Prizms when you respectively first started working on the PrizmSDK, and I know that you inexplicably are still an Nspire proponent. It therefore had slipped my mind that Tari had eventually repaired his lack of a hardware Prizm. Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement