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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
3,353件の閲覧回数
ssinfod
Contributor IV

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
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,576件の閲覧回数
kef
Specialist I

What about using ORG directive?

 

MY_ABS_RAM: SECTION
            ORG    $2800
my_abs_var      ds.b 1

 

 

If you want to use equates, you may tell simulator you have memory at specific address. See

HCS12 FCS -> Configure... menu. You may switch Mode from "auto on load" to "user defined" and add all memories you want to use. Then click Save and overwrite Default.mem if you won't not to repeat configuration steps next time you hit Run in IDE.

Message Edited by kef on 2009-09-03 06:58 AM

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,577件の閲覧回数
kef
Specialist I

What about using ORG directive?

 

MY_ABS_RAM: SECTION
            ORG    $2800
my_abs_var      ds.b 1

 

 

If you want to use equates, you may tell simulator you have memory at specific address. See

HCS12 FCS -> Configure... menu. You may switch Mode from "auto on load" to "user defined" and add all memories you want to use. Then click Save and overwrite Default.mem if you won't not to repeat configuration steps next time you hit Run in IDE.

Message Edited by kef on 2009-09-03 06:58 AM
0 件の賞賛
返信
1,576件の閲覧回数
ssinfod
Contributor IV
Thanks, both solutions solved the problem.
0 件の賞賛
返信