italiandoh

MC9S08DZ60 core test

Discussion created by italiandoh on Jul 2, 2010
Latest reply on Jul 2, 2010 by italiandoh

Hello,

we are developing a diagnostic module for this processor in which we are testing all the core instructions. These tests are coded directly in assembly language in C functions using HIL. The problem is that the compiler optimizes some instructions by replacing them with others. For example:

 

  449:       cpuBHS:
  450:          ; BHS: Branch if Higher or Same
  451:          ; A = 0x55
  452:          cmp #0x56
  007c a156     [2]             CMP   #86
  453:          bhs cpuEr                        ; Should never branch
  007e 247f     [3]             BCC   LFF ;abs = 00ff
  454:          cmp #CORETESTCFG_LOGIC_VAL1
  0080 a155     [2]             CMP   #85
  455:          bhs cpuBHS2                        ; Should branch
  0082 2402     [3]             BCC   L86 ;abs = 0086
  0084          L84:    
  456:          bra cpuEr                        ; Go fail
  0084 2079     [3]             BRA   LFF ;abs = 00ff
  0086          L86:    
  457:       cpuBHS2:
  458:          cmp #0x54
  0086 a154     [2]             CMP   #84
  459:          bhs cpuBLE                        ; Should branch
  0088 2402     [3]             BCC   L8C ;abs = 008c
  008a          L8A:    
  460:          bra cpuEr                        ; Go fail
  008a 2073     [3]             BRA   LFF ;abs = 00ff
  008c          L8C:    

We want to test the BHS instruction but the compiler uses BCC instead. The only relevant compiler options that we use are -Onf and -OnB=b.

Is there a way to solve this problem ?

Thanks in advance for any help,

 

Matteo

Outcomes