Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » MSPGCC
  • » [Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc [RSS Feed]

#1 June 2, 2010 04:33:11

Paul F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc


Peter, thanks.I had been using -O2 and -O3, but I did not know about -Os. I tried itand the original error is now gone.I am now getting a series of errors like the following:
=================

C:\Users\Paul\cc16wBFJ.o: In function `display_update':
main.c:(.text+0x108): warning: internal error: unsupported relocation error
main.c:(.text+0x1ea): warning: internal error: unsupported relocation error
C:\Users\Paul\cc16wBFJ.o: In function `wakeup_event':
main.c:(.text+0x29a): warning: internal error: unsupported relocation error

Any help appreciated.

Thanks,
Paul

On 6/1/2010 2:08 PM, Peter Bigot wrote:...
Try compiling with -Os if you aren't already. If that doesn't work, you'll
have to remove functions until it fits.

Peter

On Tue, Jun 1, 2010 at 1:53 PM, Paul F. Sehorne<p***@*ehorne.org> wrote:Having gotten past the compiling phase in my effort to port the TI
Sports Watch code to mspgcc, I'm moving on to the linking phase.

I'm getting the following error:


c:\users\paul\documents\programming\texas_instruments\ez430\mspgcc4\bin\..\lib\gcc\msp430\4.4.3\..\..\..\..\bin\msp430-ld.exe:
build/chronos.430 section `.text' will not fit in region `text'

c:\users\paul\documents\programming\texas_instruments\ez430\mspgcc4\bin\..\lib\gcc\msp430\4.4.3\..\..\..\..\bin\msp430-ld.exe:
section .vectors loaded at overlaps section .text
loaded at

c:\users\paul\documents\programming\texas_instruments\ez430\mspgcc4\bin\..\lib\gcc\msp430\4.4.3\..\..\..\..\bin\msp430-ld.exe:
region `text' overflowed by 11324 bytes

I don't really know where to start. The mspgcc docs are no help. I know
that both IAR and CCS use a linker command file, but I don't know how to
implement such in mspgcc.

Anypointers are appreciated.

Thanks,
Paul

Offline

#2 June 7, 2010 19:00:42

J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc


I suggest replacing the intrinsic functions by macros or inline-functions with
hand-crafted inline assembly code.
This way, you have full control over the generated assembly code and it can be
written as small as possible.
e.g. the delay function: take the parameter, shift it right by 3 bits and
generate a loop that takes exactly 8 cycles.
Generates only a few bytes code , and gives an exact result. (unless an ISR is
intercepting).
Using a function would be inefficient, not for the funciton call overhead
(which can be calculated and subtracted), but for the preparation of the
function call (mving the parameter to r15) and clobbering r12-r15 -> larger
code in the calling fucntion for about 4 saved bytes per call.
If you have access to IAR, you can even look into the debugger for the
generated code for these intrinsics and copy it.

While mspgcc does many sophisticated optimisations, I found that sometimes
these optimisations can be easily optimized even more. There are unnecesssary
register moves and similar thing left. Maybe a second
optimisation pass could do some good :)
So if you have to do something tight, use inline assembly. These intrinsics are
good candidates for doing so.

JMGross

----- Ursprüngliche Nachricht -----
Von: Paul F. Sehorne
An: Richard Newman; GCC for MSP430 -http://mspgcc.sf.netGesendet am: 04 Jun 2010 05:09:13
Betreff: Re: mspgcc linking problems porting TI Sports Code to
mspgcc


I have completed the port to mspgcc except for the following items:
The last linking hurdle, the "warning: internal error: unsupported
relocation error", remains. This is caused by a bug in mspgcc4. The
bug has been fixed but has not been integrated into the mainstream
mspgcc4 code.
It was necessary to use -Os to get the code size down to the 32Kb flash
size of the MSP430F6137 - even after eliminating all bluerobin code.
I have not implemented the intrinsic function __delay_cycles
None of the four intrinsic functions have been tested - due to the
linking problem. My first pass as these was just dummy functions to get
past the compile errors and move on to linking. I wanted to get through
the complete build procedure - compiling and linking - and then come
back to the intrinsic functions. Three of the intrinsic functions have
been implemented (they are not just dummy code / empty functions, like
__delay_cycles still is), but as mentioned have not actually been
tested. I am getting a clean compile with no errors.
I am getting the compile 'warning' in mspgcc4 signal.h
There are a couple of areas in the code where I used #ifdefined __GNUC__
to implement mspgcc specific functionality. These areas may need
refinement.

Offline

#3 June 11, 2010 20:47:01

Paul F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc


Yesterday I installed mspgcc4 on a Ubuntu 9.10 Linux machine and copiedmy TI eZChronos Sports Watch project to the machine. Upon building theprogram I get the same error as when building on Windows 7.This is a showstopper for me. I cannot proceed with mspgcc4 as long asthis problem exists.To reiterate one of my previous posts, the problem (in my case) has todo with pointers to functions. Both of the following two lines from TISports Watch main.c cause the error.ptrMenu_L1 =&menu_L1_Time;
fptr_lcd_function_line1 = ptrMenu_L1->display_function;TI's code makes extensive use of pointers to function for the manymenus. I can see me writing code of my own without pointers tofunctions. Thus, this is a show stopper for mspgcc4 and me. And surelyI am not the only one experiencing this problem.Paul



On 6/1/2010 3:33 PM, Paul F. Sehorne wrote:C:\Users\Paul\cc16wBFJ.o: In function `display_update':
main.c:(.text+0x108): warning: internal error: unsupported relocation error
main.c:(.text+0x1ea): warning: internal error: unsupported relocation error
C:\Users\Paul\cc16wBFJ.o: In function `wakeup_event':
main.c:(.text+0x29a): warning: internal error: unsupported relocation error--
Paul


Sehorne owned or managed Web Sites

* Airport Homes <http://airporthomes.org/>
* Female Body Building <http://bodybuilding.sehorne.net/>
* Credit Repair <http://creditrepair.sehorne.net/>
* Personal Loans <http://personalloans.sehorne.net/>
* Shopping <http://shop.sehorne.net/>
* Hidden Valley Airpark <http://hiddenvalleyairpark.org/>

Offline

#4 June 12, 2010 06:39:28

Paul F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc


I'm working on it....

On 6/11/2010 10:10 AM, Peter Bigot wrote:If you will provide a complete standalone example that reproduces the
problem I'll take a look at this.

Offline

#5 June 12, 2010 12:37:54

Paul F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc


Jim,I am taking your suggestion for the __delay_cycles intrinsic function.Thanks for the suggestion.Paul

On 6/7/2010 6:00 AM, JMGross wrote:I suggest replacing the intrinsic functions by macros or inline-functions with
hand-crafted inline assembly code.
This way, you have full control over the generated assembly code and it can be
written as small as possible.
e.g. the delay function: take the parameter, shift it right by 3 bits and
generate a loop that takes exactly 8 cycles....

JMGross

Offline

#6 June 14, 2010 19:12:50

J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc


Personally, I strongly discourage the use of this function at all, as the delay
depends on the current processor speed. If you port the code to a faster MSP
(e.g. moving form the 8MHz 1xx to the 16MHz54xx series or
even from the 54xx to the - else identical - 25MHz 54xxA), the delay will
shorten and you''l have to check and adjust all the code (or it might break and
you'll wonder why). If adjusting is possible at all (e.g. library code
used on different CPUs)
Using timers is way better, and that's why the MSP has so many :) If you define
a system-wide timer that will always initialized to, say, 1MHz. Doing delays
then is easy (a simple "TACCRx=TAR+delay;" and wait for
the interrupt flag) and will always take the same time. As a side effect, CCR0
can be used for a system timer tick with ease.
Normally, you need a certain TIME delay and not a certain CYCLE delay. Also,
wehen using a small ISR for the CCR, you can even enter LPM during the delay -
if it is long enough for the overhead.

It's a convenient thing when you start and still much better than these
for-loops, but you'll get a bad habit with it and it might kill your code when
you move on to more sophisticated projects later.

JMGross


----- Ursprüngliche Nachricht -----
Von: Paul F. Sehorne
An: mspgcc-us***@*ists.sourceforge.net
Gesendet am: 12 Jun 2010 06:37:45
Betreff: Re: mspgcc linking problems porting TI Sports Code to
mspgcc

Jim,
I am taking your suggestion for the __delay_cycles intrinsic function.
Thanks for the suggestion.

Paul

On 6/7/2010 6:00 AM, JMGross wrote:
>
> I suggest replacing the intrinsic functions by macros or inline-functions
> with hand-crafted inline assembly code.
> This way, you have full control over the generated assembly code and it can
> be written as small as possible.
> e.g. the delay function: take the parameter, shift it right by 3 bits and
> generate a loop that takes exactly 8 cycles....
>
> JMGross

Offline

#7 June 14, 2010 23:43:50

Paul F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc


Great points Jim. Thanks.I've seen a couple of places in the TI code where I didn't think thefunctionality was well thought out, and after porting the code my intentis to go back and refine some areas. On the other hand, there are acouple of areas that I should change not, rather than later, as they arecausing me delays in my goal (for example, not using the__even_in_range function for a single case statement will allow me tomove on to other more pressing issues).BTW, I consider you like the old E.F. Hutton commercials (showing myage) - when you speak, I listen.Paul.

On 6/14/2010 6:12 AM, JMGross wrote:Personally, I strongly discourage the use of this function at all, as the delay
depends on the current processor speed. If you port the code to a faster MSP
(e.g. moving form the 8MHz 1xx to the 16MHz54xx series or
even from the 54xx to the - else identical - 25MHz 54xxA), the delay will
shorten and you''l have to check and adjust all the code (or it might break and
you'll wonder why). If adjusting is possible at all (e.g. library code
used on different CPUs)
Using timers is way better, and that's why the MSP has so many :) If you define a
system-wide timer that will always initialized to, say, 1MHz. Doing delays then is easy
(a simple "TACCRx=TAR+delay;" and wait for
the interrupt flag) and will always take the same time. As a side effect, CCR0
can be used for a system timer tick with ease.
Normally, you need a certain TIME delay and not a certain CYCLE delay. Also,
wehen using a small ISR for the CCR, you can even enter LPM during the delay -
if it is long enough for the overhead.

It's a convenient thing when you start and still much better than these
for-loops, but you'll get a bad habit with it and it might kill your code when
you move on to more sophisticated projects later.

JMGross


----- Ursprüngliche Nachricht -----
Von: Paul F. Sehorne
An: mspgcc-us***@*ists.sourceforge.net
Gesendet am: 12 Jun 2010 06:37:45
Betreff: Re: mspgcc linking problems porting TI Sports Code to
mspgcc

Jim,
I am taking your suggestion for the __delay_cycles intrinsic function.
Thanks for the suggestion.

Paul

On 6/7/2010 6:00 AM, JMGross wrote:I suggest replacing the intrinsic functions by macros or inline-functions with
hand-crafted inline assembly code.
This way, you have full control over the generated assembly code and it can be
written as small as possible.
e.g. the delay function: take the parameter, shift it right by 3 bits and
generate a loop that takes exactly 8 cycles....

JMGross

Offline

  • Root
  • » MSPGCC
  • » [Mspgcc-users] mspgcc linking problems porting TI Sports Code to mspgcc [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support