Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

search inside this forum
search inside all forums
Problem using paged memory
Daniel M. Feb 20, 2018 at 09:20 PM (21:20 hours)
Staff: Takao Y.

  • Hi, 

    I have been using CodeWarrior IDE v5.9.0 build 5294 (Development Studio for S12(X) v5.2 build 151201) on a Windows7 machine for about a year to upload assembly code to the DEVKIT S12G128 board using P&E USB BDM Multilink without any problems. Last week I started using paged memory as my project has exceeded 64K. I now receive an error message when trying to upload code to the DEVKIT S12G128.

    I can't even upload the following simple program:

    ;include definitions

        INCLUDE 'derivative.inc'
           
        ORG $4000

    entry: LDS #$4000 ;SP initially points to
    address $4000
    LDAA #$01

    CALL sub1

    INCA

    loop: BRA loop

    ORG PAGE_0AStart

    sub1: INCA

    RTC

    ;****************************************
    ;* Interrupt Vectors *
    ;****************************************

    ORG $FFFE
    DC.W entry ;Reset Vector

    Pressing "Make" assembles this program without a problem, and I can view the main.asm.o.lst file but when I connect the DEVKIT S12G128 and press "Debug" I receive the following "Elf Loader" error messages:

    "Error while writing to 28000...28200.
    Information:No memory at this address."

    followed by a "HI-WAVE" "Failed to load" message.

    Programs that do not have paged memory upload without any problems.

    I've searched on this forum and the NXP forum but don't know what to do.

    I tried opening a new project and also tried uploading from another computer with the same version of CodeWarrior, but the same error messages appear.

    I posted on the NXP forum and someone said global addresses must be used to write to flash, does ORG $4000 need to be changed? I'm confused.

    Can someone please tell me what changes need to be made to the code above to get it to work?




    Comments

  • Greetings,

    What does the linker script look like?


    Takao Yamada

  • Hi Takao, 

    Thanks for looking into this. The problem has been resolved. I received another reply on the NXP forum explaining that the error was occurring because in my code I was using ORG PAGE_0AStart, where

    PAGE_0AStart:  equ    $00028000

    This is a global address and I was accessing out of memory.

    Instead of “PAGE_0AStart” I should have used the alternative address “$0A8000”. Similarly “PAGE_0BStart” should be “$0B8000”.

    I tested the amended code and everything is now working. The amended code is:
    INCLUDE 'derivative.inc'
      ORG $4000
    entry:   LDS #$4000
                 LDAA  #$01
                 CALL sub1
                 INCA
    loop:     BRA loop
                 ORG    $0A8000 
    sub1:    INCA
                 RTC

    However for my own learning, is the linker script the “burner.bbl” file in the “prm” folder? The contents of this file are:

    /* logical s-record file */
    OPENFILE "%ABS_FILE%.s19"
    format=motorola
    busWidth=1
    origin=0
    len=0x1000000
    destination=0
    SRECORD=Sx
    SENDBYTE 1 "%ABS_FILE%"
    CLOSE

    /* physical s-record file */
    OPENFILE "%ABS_FILE%.phy"
    format = motorola
    busWidth = 1
    len = 0x4000

    /* logical non banked flash at $4000 and $C000 to physical */
    origin = 0x1400
    destination = 0x001400
    len = 0xC00
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x004000
    destination = 0x34000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x00C000
    destination = 0x3C000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    /* logical 128 kB banked flash to physical */
    origin = 0x088000
    destination = 0x020000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x098000
    destination = 0x24000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x0A8000
    destination = 0x288000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x0B8000
    destination = 0x2C000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x0C8000
    destination = 0x030000
    len = 0x1400
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x0CA000
    destination = 0x032000
    len = 0x2000
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x0D8000
    destination = 0x034000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x0E8000
    destination = 0x038000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    origin = 0x0F8000
    destination = 0x03C000
    len = 0x4000
    SENDBYTE 1 "%ABS_FILE%"

    CLOSE

    Regards,

    Daniel

  • Greetings,

    Thank you for the reply and update. This will hopefully be useful for all engineers, including us.


    Takao Yamada

Add comment


   Want to comment? Please login or create a new PEMicro account.







© 2018 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement