AnsweredAssumed Answered

Another segments thread, segment is not at correct address

Question asked by Carl Norman on Sep 30, 2007
Latest reply on Oct 1, 2007 by CompilerGuru
Hi,

Sorry to start another thread on this topic.

I had this problem the a couple of weeks ago and worked it out, but had no luck today..

I created a new project using MC9RS08KA2, just C code.

I am making a const_seg (MYROMTABLE), but the data just isnt at the specified address (0x3800), here is a copy and past of the code i have added to the project.

main.c
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */

//Added this
#pragma CONST_SEG MYROMTABLE
const byte test = 0x0F;
const byte test2 = 0xF0;
const byte test3 = 0xFF;
#pragma CONST_SEG DEFAULT


void main(void) {

  EnableInterrupts; /* enable interrupts */
  /* include your code here */

  for(;:smileywink: {
    __RESET_WATCHDOG(); /* feeds the dog */
 //added this
  PTADD = test;
 
  } /* loop forever */
  /* please make sure that you never leave main */
}

PRM file

/* This is a linker parameter file for the MC9RS08KA2 */

NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */

SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
    RESERVED_RAM             =  NO_INIT      0x0000 TO 0x0004;
    TINY_RAM                 =  READ_WRITE   0x0005 TO 0x000D;
    DIRECT_RAM               =  READ_WRITE   0x0020 TO 0x004F;
    FLASHROMTABLE            =  READ_ONLY    0x3800 TO 0x38FF;
    ROM                      =  READ_ONLY    0x3900 TO 0x3FF7;
//  RESET_JMP_AREA           =  READ_ONLY    0x3FFD TO 0x3FFF; // area defined by RESET 0 below.
END

PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */
    RESERVED                 INTO RESERVED_RAM;
    TINY_RAM_VARS            INTO TINY_RAM;
    DIRECT_RAM_VARS,
    DEFAULT_RAM              INTO DIRECT_RAM, TINY_RAM;
    MYROMTABLE               INTO FLASHROMTABLE;
    DEFAULT_ROM              INTO ROM;
END


STACKSIZE 0x00 /* no stack for RS08 */

VECTOR 0 _Startup /* Reset vector: this is the default entry point for an application. */




Outcomes