MC9S12G128 bootloader

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

MC9S12G128 bootloader

2,713 Views
yongban
Contributor II

请教个问题:

在设计bootloader 之前,我在 9S12G128 app 代码:

按照AN4258 如下步骤改动:

  ROM_4000     = READ_ONLY     0x4000 TO   0x7F7F;  (文档是7F0F,对应的参考代码是7F7F

  ROM_C000     = READ_ONLY     0xC000 TO   0xEFDF;

/* paged FLASH:                     0x8000 TO   0xBFFF; addressed through PPAGE */
      PAGE_08       = READ_ONLY   0x088000 TO 0x08BFFF;
      PAGE_09       = READ_ONLY   0x098000 TO 0x09BFFF;
      PAGE_0A       = READ_ONLY   0x0A8000 TO 0x0ABFFF;
      PAGE_0B       = READ_ONLY   0x0B8000 TO 0x0BBFFF;
      PAGE_0C       = READ_ONLY   0x0C8000 TO 0x0C93FF;
      PAGE_0C_A000  = READ_ONLY   0x0CA000 TO 0x0CBFFF;
      PAGE_0E       = READ_ONLY   0x0E8000 TO 0x0EBFFF;
/*    PAGE_0D       = READ_ONLY   0x0D8000 TO 0x0DBFFF; not used: equivalent to ROM_4000 */
/*    PAGE_0F       = READ_ONLY   0x0F8000 TO 0x0FBEFF; not used: equivalent to ROM_C000 */
END

PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
      _PRESTART,              /* Used in HIWARE format: jump to _Startup at the code start */
      STARTUP,                /* startup data structures */
      ROM_VAR,                /* constant variables */
      STRINGS,                /* string literals */
      VIRTUAL_TABLE_SEGMENT,  /* C++ virtual table segment */
    //.ostext,                /* OSEK */
      NON_BANKED,             /* runtime routines which must not be banked */
      COPY                    /* copy down information: how to initialize variables */
                              /* in case you want to use ROM_4000 here as well, make sure
                                 that all files (incl. library files) are compiled with the
                                 option: -OnB=b */
                        INTO  ROM_C000/*, ROM_1400, ROM_4000*/;

      DEFAULT_ROM       INTO  PAGE_08, PAGE_09, PAGE_0A, PAGE_0B, PAGE_0C, PAGE_0C_A000, PAGE_0E 

 

void main(void)
{

 

  IVBR = 0x7F;
//set the vector base

 

改动后 程序无法正常运行,进去不了Main 函数;请问 还有哪里需要设置吗?

Labels (1)
0 Kudos
4 Replies

1,477 Views
920065012
Contributor II

hi,

    I meet the same question with you.How do you deal with it?

    I set the IVBR register( IVBR = 0x7F ),but the interrupt vector still at the 0xff80-0xffff. Where should I set the IVBR register,and what others should I do?

Regards,

Joy

0 Kudos

1,477 Views
iggi
NXP Employee
NXP Employee

Hi Yong,

Even we can use an online translator to translate your question, still it would be better if you can re-write it into English language.

Thanks,

iggi

0 Kudos

1,477 Views
yongban
Contributor II

Before design the bootloader ,I am changing 9S12G128 app code:

According AN4258 from NXP website

  ROM_4000     = READ_ONLY     0x4000 TO   0x7F7F;  (the document is 7F0F,but the code is 7F7F

  ROM_C000     = READ_ONLY     0xC000 TO   0xEFDF;

/* paged FLASH:                     0x8000 TO   0xBFFF; addressed through PPAGE */
      PAGE_08       = READ_ONLY   0x088000 TO 0x08BFFF;
      PAGE_09       = READ_ONLY   0x098000 TO 0x09BFFF;
      PAGE_0A       = READ_ONLY   0x0A8000 TO 0x0ABFFF;
      PAGE_0B       = READ_ONLY   0x0B8000 TO 0x0BBFFF;
      PAGE_0C       = READ_ONLY   0x0C8000 TO 0x0C93FF;
      PAGE_0C_A000  = READ_ONLY   0x0CA000 TO 0x0CBFFF;
      PAGE_0E       = READ_ONLY   0x0E8000 TO 0x0EBFFF;
/*    PAGE_0D       = READ_ONLY   0x0D8000 TO 0x0DBFFF; not used: equivalent to ROM_4000 */
/*    PAGE_0F       = READ_ONLY   0x0F8000 TO 0x0FBEFF; not used: equivalent to ROM_C000 */
END

PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
      _PRESTART,              /* Used in HIWARE format: jump to _Startup at the code start */
      STARTUP,                /* startup data structures */
      ROM_VAR,                /* constant variables */
      STRINGS,                /* string literals */
      VIRTUAL_TABLE_SEGMENT,  /* C++ virtual table segment */
    //.ostext,                /* OSEK */
      NON_BANKED,             /* runtime routines which must not be banked */
      COPY                    /* copy down information: how to initialize variables */
                              /* in case you want to use ROM_4000 here as well, make sure
                                 that all files (incl. library files) are compiled with the
                                 option: -OnB=b */
                        INTO  ROM_C000/*, ROM_1400, ROM_4000*/;

      DEFAULT_ROM       INTO  PAGE_08, PAGE_09, PAGE_0A, PAGE_0B, PAGE_0C, PAGE_0C_A000, PAGE_0E 

void main(void)
{

 

  IVBR = 0x7F;
//set the vector base

but after changing the code,the code can not work, Can not enter into the main ();  Is there where I need to set up?

0 Kudos

1,477 Views
iggi
NXP Employee
NXP Employee

Hi,

What did you change exactly?

The 0x7F7F is the max limit for ROM_4000 in the application project. Interrupt vector table is located at 0x7F80 - 0x7FFF.

So it doesn't matter if the limit is 0x7F7F or 0x7F0F, this should not have impact.

Have you done other modifications?

Regards,

iggi

0 Kudos