The internal frequency is nominally 16-MHz and the default ICS settings will provide for aYet page 21, figure 1-2 (clock distribution) shows the BUSCLK as divided by 2 from ICSOUT. So which is it? Seems to me that the bus clock should be 8MHz, but it's stated that it will be 4 by default.
4-MHz bus out of reset.
irob -
The correct answer is 4MHz. See this thread. The last post has the correct explanation.
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=1520#M1520
- Rocky
Ahh, thanks Rocky. Regardless, I tried my project both ways and for 4MHz bus clock, I have this:
Code:
FCDIV = 0x13; // FLASH clock initialization to 200kHz
0x13 is a 0 for PRDIV8 and a 19d for DIV. Yet, I'm not seeing anything going on with my flash target page at 0xE200.
Here's a possible problem. I have the following compiler warning:
A13003: Value is truncated to one byte
Here's the code in question:
Code:
I_cont: ais #SpSubSize+3 ;deallocate sub body + H:X + commandSpSubSize: equ (*-SpSub)
The top line gets the warning. I'm not seeing what the problem is. The AIS operand supports immediate addressing.
Message Edited by bigmac on 2006-06-23 02:16 PM
Hello irob,
It would seem more likely that the linker cannot find the value of SpSubSize. I assume that the instructions following the Icont label would either need to be in the same file as SpSub routine, or alternatively the file containing SpSub would need to be INCLUDEd prior to the Icont instructions.
Regards,
Mac
bigmac wrote:I assume that the instructions following the Icont label would either need to be in the same file as SpSub routine, or alternatively the file containing SpSub would need to be INCLUDEd prior to the Icont instructions.
Message Edited by irob on 2006-06-28 05:36 PM
IROB.ASM Assembled with CasmHCS08_Pro v1.00 24/06/2006 3:35:08 PM PAGE 1 0000FEEF 1 FSTAT equ $feef 00 0000FEEE 2 FCMD equ $FEEE 00 00000080 3 FACCERR equ %10000000 00 4 5 org $e800 6 7 *SpSub: ldhx LOW(SpSubSize+4),sp ;get flash add ress from stack E800 [05] 9EFE1C 8 SpSub: ldhx SpSubSize+4,sp ;get flash address f rom stack E803 [02] F7 9 sta 0,x ;write to flash; latch addr and data E804 [05] 9ED6001B 10 lda SpSubSize+3,sp ;get flash command E808 [04] C7FEEE 11 sta FCMD ;write the flash command E80B [02] A680 12 lda #FACCERR ;mask to initiate command E80D [04] C7FEEF 13 sta FSTAT ;[pwpp] register command E810 [01] 9D 14 nop ;[p] want min 4~ from w cycle to r E811 [04] C6FEEF 15 ChkDone: lda FSTAT ;[prpp] so FCCF is valid E814 [01] 48 16 lsla ;FCCF now in MSB E815 [03] 2AFA 17 bpl ChkDone ;loop if FCCF = 0 E817 [06] 81 18 SpSubEnd: rts ;back into DoOnStack in flash 00000018 19 SpSubSize: equ (*-SpSub) 00 20 E818 [02] A618 21 I_cont: lda #SpSubSize E81A [02] AB03 22 add #3 E81C [02] 87 23 psha 24 0000001A 25 test1 equ $1A 00 00000002 26 test2 equ $2 00 00000018 27 test3 equ (test1-test2) 00 Symbol Table 0000E811 CHKDONE 00000080 FACCERR 0000FEEE FCMD 0000FEEF FSTAT 0000E818 I_CONT 0000E800 SPSUB 0000E817 SPSUBEND 00000018 SPSUBSIZE 0000001A TEST1 00000002 TEST2 00000018 TEST3 Absolute Memory Utilization by Segments Address Range Length Segment Name------------------- ---------- -------------- 0000E800-0000E81C 0000001D
Hello Peg, irob,
Actually the CW assembler doesn't complain either provided a single file contains both SpSub and Icont routines, and with the use of absolute assembly. I assume that Peg's sample also uses absolute assembly. The main concern with the warning message would be if the value was truncated to zero (as it could well be if the linker could not identify the reference). The value of SpSubSize should be known when Icont is linked, and for the example given this is a non-zero single byte value, so the warning message should not occur.
With relocatable assembly, if the two routines happen to be in different files, I believe XDEF and XREF directives should be included with respect to the value (symbol) SpSubSize.
Regards,
Mac
I_cont: ais #SpSubSize+3 ;deallocate sub body + H:X + commandprecede the line
SpSubSize: equ (*-SpSub)?
Message Edited by rocco on 2006-06-25 12:35 AM
rocco wrote:
Does the code lineI_cont: ais #SpSubSize+3 ;deallocate sub body + H:X + commandprecede the lineSpSubSize: equ (*-SpSub)?
I have found that my assembler (prior to CW) does not complain about the truncation if it already knows that the high byte is zero. If the reference to "SpSubSize" precedes the definition, it doesn't yet know that.
SpSubSize: equ (*-SpSub)to before the I_cont line is that SpSub occurs after I_cont.
Hello irob,
When an immediate value includes some arithmetic, you might need to surround the expression by parenthesis.
I_cont: ais #(SpSubSize+3)
I seem to recall that I previoulsy experienced a similar problem, but not necessarily with this specific instruction.
Regards,
Mac
bigmac wrote:When an immediate value includes some arithmetic, you might need to surround the expression by parenthesis.
I seem to recall that I previoulsy experienced a similar problem, but not necessarily with this specific instruction.
Hi Rob,
The AIS instruction ONLY accepts immediate and it is sign extended 8-bit. It looks like you are trying to squeeze a bigger value in there.
Also can someone re-rate my two posts referred to here by Rocky, now the wrong one has 5 and the correct none!
Regards David
Message Edited by irob on 2006-06-21 06:47 PM
Message Edited by irob on 2006-06-21 06:48 PM
Hi Robyn,
The asterisk in this example means current address
the minus sign means minus (just like you learnt in 1st grade)
So the label will equate to the current address less the value of SpSub
Which is perhaps equal to the size of the routine???
Regards David