1

I'll try to track my progress a little bit here for people to follow. I'm not going to make any guarantees, but I plan to do this for fun. I work full time at a real job smile and am working on finishing my masters degree, so I'm usually pretty busy.

today i started to understand how ld-tigcc is constructed and added in a -flash-app switch, but I have a lot of learning to do.... smile I feel rusty but comfortable... haven't written any serious amount of C code in probably 4+ years! The actual structure of a FLASH application is very simple and documented well by TI. I've also noticed that there are many ROM calls that TI has documented well which tigcc/gcc4ti don't have documented. tiams.h that comes with flash studio is helpful as are the pdf files on TI's website.

[code]
/*
Layout of a FLASH application:
1) Flash header (TI-Graph Link)
2) Certificate header
3) Application Header (type FLASH_APP_HEADER defined below)
4a) Relocation Map
4b) Application code
4c) Initial data table
*/

// *** Constants ***
#define FLASH_APP_MAGIC 0x167B533D
#define FLASH_APP_APPHDR_LOCALIZER 0x0001

// *** File Mapping Definitions ***

typedef struct ATTRIBUTE_PACKED

{

TI4 magic; //FLASH_APP_MAGIC
char name[[ 8 ]]; //Internal Name of the FLASH app. Must be unique from all other FLASH apps installed on the calculator.
I1 zeros[24]; //Reserved - initialize to zeros
TI2 flags; //Bit field FLASH_APP_APPHDR_LOCALIZER or zero.
TI4 dataLen; //Amount of static RAM to allocate for the FLASH APP. Contains static initialized (.data) and uninitialized (.bss) RAM sections
TI4 codeOffset; //Byte offset to code is a header-relative pointer to the beginning of the application code image
TI4 initDataOffset; //.data section is initialized by copying the data from this table
TI4 initDataLen; //length of initial data table
TI4 optlen; //optional header can follow this structure of optlen length. Never used by TI. Currently not used by ld-tigcc.
} FLASH_APP_HEADER;
[code]

2

dietsche (./1) :
today i started to understand how ld-tigcc is constructed and added in a -flash-app switch, but I have a lot of learning to do....


Good luck. It isn't an easy program to understand. Don't forget to read ALSO the start up sections in tigcclib.a.
By the way, as TI mentionned you may need to link with another tigcclib.a than the standard one.
One that separate BSS section for data and TEXT section for code.
You can also see what I have done for integrating the BSS sections into the Flash OS switch.

3

We can't just copy the documentation from TI's PDF, that'd be a copyright violation.

As for adding the export target to ld-tigcc, one problem is that the TIGCC IDE and tigcc.exe in Delphi use a link.dll which delegates part of the exporting to Delphi code. That's annoying code duplication and means you'll have to write some Delphi to fully implement the feature. (This is one reason I want to move to KTIGCC everywhere.)
avatarMes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité