How to put the function at a absolute address? - s12xdt256

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to put the function at a absolute address? - s12xdt256

1,689 Views
slade
Contributor I

Hello,

I use s12xdt256 chip and I need to put the function at a absolute address for compatible reason.

For example: I want to put A() at ppage address 0xe4bf8a, How can I do?

I try to use .prm file to allocate a fix address for the function, it works but it would arise another problem => the length of the content of the *.s19 file is not equal, it would make the code downloading fail.

So my question is if any easy way to put the function at an absolute address or how to make the length of the content of the *.s19 file equal?

thanks

 

slade

 

Added p/n to subject.

Message Edited by NLFSJ on 2009-05-28 08:16 AM
Labels (1)
0 Kudos
4 Replies

386 Views
slade
Contributor I

Thans J2ME,

I think the fault is I write flash in a misaligned word, it is not allowed in the flash operation.

So now I just compile carefully to makw sure the function is in the exactly position that I want, it is a little stupid thing but the problem solve:smileyhappy:

 

thanks

slade

0 Kudos

386 Views
CrasyCat
Specialist III

Hello

 

Only way to get a function at an absolute address is to allocate it in a user defined section and place that section at that particular address.

 

As a guideline I would recommend putting a function which needs to be allocated at a specific address at the beginning of a memory area. Otherwise you will have some memory areas which cannot be used an more.

 

I do not understand what you mean with  "how to make the length of the content of the *.s19 file equal".

If you rebuild the application after applying some changes (or using a new compiler version), code size will change. But I do not see how this could create a problem loading the application.

 

 

CrasyCat

0 Kudos

386 Views
slade
Contributor I

Thanks Crazycat,

The *.prm setting is as following:

 

SEGMENTS

      FLASH_F9_SECTOR0        = READ_ONLY    0xF98000 TO 0xF9ADAE;
      FLASH_F9_SECTOR1        = READ_ONLY    0xF9ADAF TO 0xF9BFFF; 

      FLASH_FA_SECTOR        = READ_ONLY    0xFA8000 TO 0xFABFFF;

PLACEMENT

      DEFAULT_ROM        INTO   FLASH_FB_SECTOR, FLASH_FA_SECTOR, FLASH_F9_SECTOR0,  FLASH_F8_SECTOR,
              FLASH_E7_SECTOR, FLASH_E6_SECTOR, FLASH_E5_SECTOR, FLASH_E4_SECTOR,
         FLASH_E0_0_SECTOR, FLASH_FE_SECTOR1;

      FUN_ADD_FIX_ROM    INTO FLASH_F9_SECTOR1;

 

The part of *.s19 file is as following

S224F9AD80032025EC82260BEC808C7F802604C6022016EC80C480847FCE000034CD7F8035F9
S20FF9ADA0B7C516D49A2601521B840A88
S224F9ADAF6CAACCFFFF6C821869842025EE8918AB84E683E8008759180B7F0010B74518E6D3

The length of the 2nd line is different from others, it would result to the downloading function fail.

If any way to deal with the length, I am new to the file format.

 

thanks

slade

 

0 Kudos

386 Views
J2MEJediMaster
Specialist I

I can speak to the S-record format. The first two characters (S2) describe the record type (there's S0, S1, S2, S3... and so on). The third and fourth characters describe the number of character *pairs* remaining in the record. For that second, short record, the value is fifteen decimal, and sure enough there are 15 character pairs remaining in that record. Whatever's doing the parsing of the S-records ought to be able to read that length value and handle reading the rest of the record correctly.

 

I've attached a short description of the S-record format to help.

 

---Tom

0 Kudos