AnsweredAssumed Answered

How can i use ROM Library ?

Question asked by 昊 吴 on Jun 12, 2018
Latest reply on Jun 18, 2018 by ZhangJennie

Hi,

   I am cutting our software project in two small projects.  One is Application project,the other is Bootloader. So I decided to use ROM libraries as this technic allowed me to include bootloader within my application without paying attention to bootloader. But always failed, can't even create a simple ROM libraries example. Who can provide examples for using ROM Library, or find our mistake ? 

   Hi, Erich Styger! I know you are professional, so specially mention you.

 

Detailed description is s follows:

IDE: CodeWarrior IDE version 5.9.0

Chip: MC9S12VR48

ROM Library project:

#include "rl.h"
#include <startup.h>

struct _tagStartup _startupData;
static char RL_counter;

char Add(char a) {
RL_counter += a;
   return RL_counter;
}

char RL_Count(void) {
   return Add(5);
}

   

// Turn on "Link as ROM library" in SmartLinker Option Settings

NAMES END

SEGMENTS
MY_RAM = READ_WRITE 0x3800 TO 0x38FF;
MY_ROM = READ_ONLY 0xE000 TO 0xEFFF;
END
PLACEMENT
DEFAULT_ROM, ROM_VAR, STRINGS INTO MY_ROM;
DEFAULT_RAM INTO MY_RAM;
END

      

Applicaiton project:  

#include "rl.h"

static unsigned char b;

void main(void) {
   b = RL_Count();
}

 

NAMES END

SEGMENTS
RAM = READ_WRITE 0x3900 TO 0x3FFF;
ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
END

PLACEMENT
_PRESTART,STARTUP,ROM_VAR,STRINGS,VIRTUAL_TABLE_SEGMENT,DEFAULT_ROM, NON_BANKED,COPY
INTO ROM_4000;
SSTACK,DEFAULT_RAM
INTO RAM;
END

ENTRIES
RL_Count
END

STACKSIZE 0x100

VECTOR 0 _Startup

 

*********************************************************************************************
OBJECT-ALLOCATION SECTION
Name Module Addr hSize dSize Ref Section RLIB
---------------------------------------------------------------------------------------------
MODULE: -- romlib.lib --
- PROCEDURES:
RL_Count E028 5 5 1 @
- VARIABLES:

*********************************************************************************************
OBJECT LIST SORTED BY ADDRESS
Name Addr hSize dSize Ref Section RLIB
---------------------------------------------------------------------------------------------

None RL_Count description

*********************************************************************************************
DEPENDENCY TREE
*********************************************************************************************
main and _Startup Group
|
+- main
| |
| +- RL_Count
|
+- _Startup
|
+- Init
|
+- main (see above)

 

Question:

1. In the map file, Only “OBJECT-ALLOCATION SECTION” mention RL_Count, but “OBJECT LIST SORTED BY ADDRESS” does not. There is no corresponding information in the S-record file. So how can i download application and bootloader to debug ?

2. DEPENDENCY TREE does not include Add, Do all the functions need to be in “ENTRIES END” ?

3. How to make Bootloader and Application variables use common RAM segment but not conflict ?

 

 

 

 

Thanks all.

 

 

Erich Styger

Outcomes