Jump to content
insomnia

GCC for the TI

Recommended Posts

On 7/22/2019 at 6:07 AM, Mobsie said:

The installer stop with an error, see the picture.

The picture shows that you are compiling with Clang. Try GCC. Even then I don’t know if it will work.  The build process works on Linux but doesn’t work on all flavors of Linux. Mac is *like* Linux, but they are not the same.

  • Like 2

Share this post


Link to post
Share on other sites
On 7/26/2019 at 3:12 AM, Mobsie said:

thank you all.

With help from PeteE i was able to build all on osx.

 

Hi Mobsie,

 

I'm trying to build on OS X El Capitan (last OS build my MacBook supports).  I have installed GMP and MPFR using MacPorts, but the scripts fail to find them and GCC fails to build.  Any idea on how to fix this?  Thought this might have been addressed in your setup.

Share this post


Link to post
Share on other sites
3 hours ago, klrw111-78 said:

I'm trying to build on OS X El Capitan (last OS build my MacBook supports).  I have installed GMP and MPFR using MacPorts, but the scripts fail to find them and GCC fails to build.  Any idea on how to fix this?  Thought this might have been addressed in your setup.

Here is the modified script I sent to Mobsie.  He got it to work, so perhaps you can too.

install-mac.sh

  • Like 3

Share this post


Link to post
Share on other sites
On 10/15/2019 at 1:03 AM, PeteE said:

Here is the modified script I sent to Mobsie.  He got it to work, so perhaps you can too.

install-mac.sh 3.69 kB · 4 downloads

Thanks for the script.  It showed me how to make the changes for my environment.  Everything worked up to the point of calling the linker for the gcc compile.  The errors involved failure to find symbols.  Going to re-install the Xcode setup and try again.

Share this post


Link to post
Share on other sites

I wrote a simple function today that seems to show unreachable instructions being generated: 

 

int hasRam() {
  volatile int* lower_exp = (volatile int*) 0x2000;
  *lower_exp = 0;
  *lower_exp = 0x1234;
  return (*lower_exp == 0x1234);
}

 

that compiled into the following:

 

        def     hasRam
hasRam
        clr  @>2000
        li   r1, >1234
        mov  r1, @>2000
        mov  @>2000, r2
        clr  r1
        ai   r2, >EDCC
        jeq  L13
        b    *r11
        jmp  L14
L13
        li   r1, >1
        b    *r11
L14
        .size   hasRam, .-hasRam

 

The instruction just prior to L13 is unreachable, and unnecessary.  compiled with -O2

 

[email protected]
 

  • Like 2

Share this post


Link to post
Share on other sites
22 hours ago, jedimatt42 said:

I wrote a simple function today that seems to show unreachable instructions being generated: 

 

int hasRam() {
  volatile int* lower_exp = (volatile int*) 0x2000;
  *lower_exp = 0;
  *lower_exp = 0x1234;
  return (*lower_exp == 0x1234);
}

 

that compiled into the following:

 

        def     hasRam
hasRam
        clr  @>2000
        li   r1, >1234
        mov  r1, @>2000
        mov  @>2000, r2
        clr  r1
        ai   r2, >EDCC
        jeq  L13
        b    *r11
        jmp  L14
L13
        li   r1, >1
        b    *r11
L14
        .size   hasRam, .-hasRam

 

The instruction just prior to L13 is unreachable, and unnecessary.  compiled with -O2

 

[email protected]
 

Interesting.

I can see that it has a rigid if-else pattern where 'return' is treated as an ordinary statement in each clause.

 

vs hand-coding, the compiler doesn't seem to make good use of registers. But I don't blame it. Compiler code-generation still  seems like magic to me.

 

I wonder if declaring lower_exp as register would help.

Also a register const int x = 0x1234;

 


Using one more register R0

    clr  r1
    li   r0,>2000
    clr  *r0
    li   r2,>1234
    mov  r2,*r0
    c    *r0,r2
    jne  L13
    inc  r1
L13    
    b    *r11

11 words vs 15

 

 

 

  • Like 2

Share this post


Link to post
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.

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...