sammielove45 / propgcc

Automatically exported from code.google.com/p/propgcc
1 stars 1 forks source link

compile with gcc, test with ppropellersim #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'd like to know what combination of 
gcc toolchain (compile and objcopy, whatever
is needed)

produces a binary code that I can load with
ppropellersim and test

Can someone point me to a short howto do this

Original issue reported on code.google.com by vor...@gmail.com on 6 Jul 2012 at 6:42

GoogleCodeExporter commented 9 years ago
We have not tested propeller gcc with that simulator.

It is likely that the simulator will run spin programs so the propeller-load 
program should be used to convert a propeller-gcc elf to a spin binary. For 
example.

$ propeller-elf-gcc hello.c -o hello.elf
$ propeller-load -s hello.elf

Output from propeller-load -s hello.elf is hello.binary

An example using spinsim will be attached below. ppropellersim should work the 
same.

Original comment by jsden...@gmail.com on 7 Jul 2012 at 2:04

GoogleCodeExporter commented 9 years ago

Here is an example using spinsim which is in the propeller-gcc distribution.

$ cat hello.c
#include <stdio.h>

void main(void)
{
    printf("hello, world\n");
}

$ propeller-elf-gcc hello.c -o hello.elf

$ ls -l hello.elf
-rwxr-xr-x 1 steve sudo 11581 Jul  6 18:59 hello.elf

$ propeller-load -s hello.elf

$ ls -l hello.binary 
-rw-r--r-- 1 steve sudo 5872 Jul  6 18:59 hello.binary

$ spinsim -b hello.binary 
hello, world

Original comment by jsden...@gmail.com on 7 Jul 2012 at 2:04

GoogleCodeExporter commented 9 years ago
Note that the hello.binary was run with spinsim -b
The spinsim help is shown below.

To list instructions executed, use
$ spinsim -b hello.binary -l

Each of the characters come out in the listing on column 0 of some lines.

To see output in the terminal and create a list of instructions executed use
$ spinsim -b hello.binary -l out.txt

While it is good to see the instructions, eventually the hello program will 
stop.

$ spinsim
SpinSim Version 0.53
usage: spinsim [options] file
The options are as follows:
     -l  List executed instructions
     -l <filename>  List executed instructions to <filename>
     -p  Use PASM Spin interpreter
     -#  Execute # instructions
     -P  Profile Spin opcode usage
     -m# Set the hub memory size to # K-bytes
     -t  Enable the Prop 2 mode
     -b# Enable the serial port and set the baudrate to # (default 115200)
     -gdb Operate as a GDB target over stdin/stdout
     -L <filename> Log GDB remote comm to <filename>
     -r <filename> Replay GDB session from <filename>

Original comment by jsden...@gmail.com on 7 Jul 2012 at 2:19

GoogleCodeExporter commented 9 years ago

Original comment by jsden...@gmail.com on 7 Jul 2012 at 2:23

GoogleCodeExporter commented 9 years ago
HI

Thanks a lot for a quick and efficient response.
It works for pPropellerSim-1.0.0.12.zip

the key step is

propeller-load -s hello.elf

which generates correct propeller-tool binary "hello.binary"

that can be loaded from pPropellerSim menu
I run it on linux using:
java -jar /opt/pPropellerSim/dist/pPropellerSim.jar
choose "File->Open Propeller Tool binary" 
and load hello.binary

I haven't found yet how to display serial data
on terminal from ppropellersim, but the binary
code itself works, wonderful!

Original comment by vor...@gmail.com on 8 Jul 2012 at 9:48

GoogleCodeExporter commented 9 years ago
This request seems to have been satisfied.

Original comment by jsden...@gmail.com on 5 Sep 2012 at 2:45