To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxt.nxthackingOpen lugnet.robotics.nxt.nxthacking in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / NXT Firmware Hacking / 8
7  |  9
Subject: 
Re: GCC vs. IAR compiler: Could GCC be tweaked to generate code as tight as IAR?
Newsgroups: 
lugnet.robotics.nxt.nxthacking
Date: 
Wed, 14 Mar 2007 21:45:20 GMT
Viewed: 
17335 times
  
In lugnet.robotics.nxt.nxthacking, John Hansen wrote:
In lugnet.robotics.nxt.nxthacking, John Hansen wrote:
In lugnet.robotics.nxt.nxthacking, Rasmus Pedersen wrote:
Hi,

If I compile the LEGO firmware sources with gcc, the code size increases much
beyond the 128 KB (which I think) the IAR compiled sources fits into. That means
that one have to relocate part of the compiled code into the memory areas
between 128KB-256KB. That is ok, but not totally optimal as the files,
filehandles, and file verion info is also in that region making it a puzzle.
Also I think it is hard to download new files if the flash is partly taken for
code purposes.

Are you adjusting these values in d_loader.h?
I did not do so. The memory map in LEGO_MINDSTORMS_NXT_Firmware_v1.03.bin is
like this for the files:
0x11F000-0x12E99D  Actual files like Demo.rxe
0x13FF00-0x13FF37  FILE_HANDLE(s)
0x13FFFC-0c13FFFF  FILEVERSION

The nxtgcc stuff compiles to 126176 bytes in the .text segment just fits below
STARTOFUSERFLASH (800 byte margin). The next segment .text2 + .data is 29752
bytes and is linked in at 0x138700. So it ends up pretty close (968 bytes) from
the FILE_HANDLE(s) address.

Anyway, if IAR compiles to 121324 bytes then the converted version of the
sources is 126176+23572+6180 - 121324 = 34604 bytes larger. However, I looked in
LEGO_MINDSTORMS_NXT_Firmware_v1.03.bin and it seems like the firmware code ends
at 0x1E226, which is 123436 bytes. Do you know why there is a difference between
your compiler and the one producing the firmware?

How are the file tables generated with the IAR compiler? Is there a tool for
that? I cut (with a little utility called binsert) the three file related memory
ranges out of LEGO_MINDSTORMS_NXT_Firmware_v1.03.bin and indsert them in the gcc
compiled image:-).


#define   STARTOFFILETABLE              (0x13FF00L)
#define   STARTOFUSERFLASH              (0x11F000L)
#define   SIZEOFUSERFLASH               (STARTOFFILETABLE - STARTOFUSERFLASH)

I've been told by folks at LEGO that if I grow the size of the firmware by
adding new features that I will need to modify these values.  And the boundary
needs to be divisible by 8.


More precisely, I was told to increase the STARTOFUSERFLASH value if I increased
the firmware size beyond the current value.  The unmodified source code compiles
to 121324 bytes using the current evaluation version of the IAR Embedded
Workbench (4.41.1.201).  The STARTOFUSERFLASH is 0x1F000 which is 126976.  That
means with IAR we have about 5652 bytes to play with before it will be necessary
to increase the STARTOFUSERFLASH value.
I should try that one day and see if it can be avoided to split the code into
.text and .text2. Good hint.
Best,
Rasmus

John Hansen



Message has 1 Reply:
  Re: GCC vs. IAR compiler: Could GCC be tweaked to generate code as tight as IAR?
 
(...) LEGO is using a slightly older version of IAR Embedded Workbench. Maybe that explains it. Or maybe its a 1.03 vs 1.04 source code difference. (...) I have been told that the following is the standard operating procedure for generating the (...) (17 years ago, 15-Mar-07, to lugnet.robotics.nxt.nxthacking)

Message is in Reply To:
  Re: GCC vs. IAR compiler: Could GCC be tweaked to generate code as tight as IAR?
 
(...) More precisely, I was told to increase the STARTOFUSERFLASH value if I increased the firmware size beyond the current value. The unmodified source code compiles to 121324 bytes using the current evaluation version of the IAR Embedded Workbench (...) (17 years ago, 14-Mar-07, to lugnet.robotics.nxt.nxthacking)

11 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR