AnsweredAssumed Answered

CW 5.0 + simulator problem (No memory at ...) with an absolute address variable.

Question asked by ssinfod on Sep 3, 2009
Latest reply on Sep 3, 2009 by ssinfod

Hello,

 

I am using the Simulator/Debugger in CodeWarrior 5.0 for the 9S12DP512. (HCS12)

 

I have the message "No memory at" in the simulator when writing a value at a specific address. It looks like the simulator thinks the RAM memory is not available because the segment has not been define with a "ds" directive. Is there a way to turn off this option in the simulator ? (or) Is it because of the smart linker ?

 

This is the code giving the error :

 

 


;**************************************************************
;* This stationery serves as the framework for a              *
;* user application. For a more comprehensive program that    *
;* demonstrates the more advanced functionality of this       *
;* processor, please see the demonstration applications       *
;* located in the examples subdirectory of the                *
;* Freescale CodeWarrior for the HC12 Program directory       *
;**************************************************************
; Include derivative-specific definitions
            ;INCLUDE 'derivative.inc'

; export symbols
            XDEF Entry, _Startup, main
            ; we use export 'Entry' as symbol. This allows us to
            ; reference 'Entry' either in the linker .prm file
            ; or from C/C++ later on

            XREF __SEG_END_SSTACK      ; symbol defined by the linker for the end of the stack


;==============================================================================
; variable/data section
;==============================================================================
RAM_SEC: SECTION
; Insert here your data definition.

;
var1        ds.w 1    ; 2 bytes
var2        ds.w 1    ; 2 bytes

abs_adr:    equ $2800 ; Absolute address..

;==============================================================================
; code section
;==============================================================================
ROM_C000:     SECTION
main:
_Startup:
Entry:
            LDS  #__SEG_END_SSTACK     ; initialize the stack pointer (was: 0x0900)
            CLI                        ; enable interrupts

            ldaa   #'1'
            staa   abs_adr

            clra
            staa   var1               ; Use at least one variable

EndlessLoop:
            bra   EndlessLoop

            RTS
          

 

Anyhow, if I "allocate" the memory with a DS directive and use a variable in the memory (var1), I don't have the error message in the simulator anymore. Is there a way to simulate a variable at a specific address without having to define a serie of big buffers.

 

This code works compare to the one above :

 

 


;**************************************************************
;* This stationery serves as the framework for a              *
;* user application. For a more comprehensive program that    *
;* demonstrates the more advanced functionality of this       *
;* processor, please see the demonstration applications       *
;* located in the examples subdirectory of the                *
;* Freescale CodeWarrior for the HC12 Program directory       *
;**************************************************************
; Include derivative-specific definitions
            INCLUDE 'derivative.inc'

; export symbols
            XDEF Entry, _Startup, main
            ; we use export 'Entry' as symbol. This allows us to
            ; reference 'Entry' either in the linker .prm file
            ; or from C/C++ later on

            XREF __SEG_END_SSTACK      ; symbol defined by the linker for the end of the stack


;==============================================================================
; variable/data section
;==============================================================================
RAM_SEC: SECTION
; Insert here your data definition.

; Total of 12K.
var1        ds.w 1    ; 2 bytes
var2        ds.w 1    ; 2 bytes
b0          ds.b 764  ; (256 for stack - see PRM)
b1          ds.b 1024 ;
b2          ds.b 1024
b3          ds.b 1024
b4          ds.b 1024
b5          ds.b 1024
b6          ds.b 1024
b7          ds.b 1024
b8          ds.b 1024
b9          ds.b 1024
b10         ds.b 1024
b11         ds.b 1024


abs_adr:    equ $2800             ; Absolute address..


;==============================================================================
; code section
;==============================================================================
ROM_C000:     SECTION
main:
_Startup:
Entry:
            LDS  #__SEG_END_SSTACK     ; initialize the stack pointer (was: 0x0900)
            CLI                        ; enable interrupts

            ldaa   #'1'
            staa   abs_adr

            clra
            staa   var1                 ; Use at least one variable.

EndlessLoop:
            bra   EndlessLoop

            RTS
          

 

 

Thanks

 

 

 

 

 

 

 

Message Edited by ssinfod2 on 2009-09-03 04:32 AM
Message Edited by ssinfod2 on 2009-09-03 04:35 AM

Outcomes