Failed to Clear uninitialized data areas to zero and jump to nop

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Chip: MB9664X

I'm making platform to develop can stack. And here is the startup code:

  1050: ;   0006 2. section address (RAM)

  1051: ;   000A length of section 2

  1052: ;   000C 3. section address (RAM)

  1053: ;   0010 length of section 3 ...

  1054: ; In addition the start-up file adds the descriptors of the __near

  1055: ; sections to this table. The order of the descriptors in this table

  1056: ; depends on the linkage order.

  1057: ;====================================================================

  1058:           MOV  A, #BNKSEC DCLEAR   ; get bank of table

  1059:           MOV  DTB, A              ; store bank in DTB

  1060:           MOVW RW1, #DCLEAR        ; get start offset of table

  1061:           BRA  LABEL4              ; branch to loop condition

  1062: LABEL3:

  1063:           MOV  A, @RW1+2           ; get section bank

  1064:           MOV  ADB, A              ; save section bank in ADB

  1065:           MOVW RW0, @RW1+4         ; number of bytes to copy -> RW0

  1066:           MOVW A, @RW1             ; move section addr in AL

  1067:           MOVN A, #0               ; AL -> AH, init value -> AL

  1068:           FILSI     ADB            ; write 0 to section

  1069:           MOVN A, #6               ; length of one table entry is 6

  1070:           ADDW RW1, A              ; set pointer to next table entry

  1071: LABEL4:

  1072:           MOVW A, RW1              ; get address of next block

  1073:           SUBW A, #DCLEAR          ; sub address of first block

  1074:           CMPW A, #SIZEOF (DCLEAR) ; all blocks processed ?

  1075:           BNE  LABEL3              ; if not, branch

  1076:

  1077: ;====================================================================

  1078: ; 6.9   Set Data Bank Register (DTB) and Direct Page Register (DPR)

  1079: ;====================================================================

  1080:           MOV  A,#BNKSEC DATA          ; User data bank offset

  1081:           MOV  DTB,A

  1082:

  1083:           MOV  A,#PAGE DIRDATA_S       ; User direct page

  1084:           MOV  DPR,A

I use the code the chip provider gave to me. It run well using sample project of provider.

But when I run using it, it always loops between LABEL3 and LABEL4. Then I click run, the program will junm to "nop".

So it won't go to line 1080.

I have on idea why it works like this.

It will help me a lot if anyone can give some suggestions.

Update 2017.9.13

I found that it went like above when I add __ffmc16.c and vectors.c to compile.

Best Regards,

Kim

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Can you please provide a link to your chip's datasheet?

Bob

0 Likes