UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor murphpo
Visitor
2,538 Views
Registered: ‎05-10-2017

Bug in standalone.tcl

I think there's a bug in the standalone.tcl script in the standalone OS library for MicroBlaze.

 

The script uses the MicroBlaze core version to decide whether the CPU supports exceptions in delay slots. The suspect code is copied below (also in git). This is old code that breaks with MicroBlaze ver >= 10.0 when the string comparison returns 0 (since "10" < "5.0.0.a"). This results in the MICROBLAZE_CAN_HANDLE_EXCEPTIONS_IN_DELAY_SLOTS macro being undefined, leading to incorrect code being run in hw_exception_handler.S.

 

We observed incorrect program execution in hardware because of this bug. The compiler scheduled an unaligned memory access in a delay slot, believing (correctly) the CPU hardware supports this. However when the exception handler ran it skipped the mfs r17, rbtr; instruction, leading the exception handler to return control to the wrong address.

 

Our current workaround is to edit $SDK/data/embeddedsw/lib/bsp/standalone_v6_0/data/standalone.tcl so that the mb_can_handle_exceptions_in_delay_slots method always returns true., re-generate the BSP, then confirm MICROBLAZE_CAN_HANDLE_EXCEPTIONS_IN_DELAY_SLOTS is defined in microblaze_exceptions_g.h.

 

proc mb_can_handle_exceptions_in_delay_slots { procver } {

    if { [string compare -nocase $procver "5.00.a"] >= 0 } {
        return true
    } else {
        return false
    }
}

 

0 Kudos
2 Replies
Xilinx Employee
Xilinx Employee
2,464 Views
Registered: ‎10-21-2010

Re: Bug in standalone.tcl

Hi,

 

Thanks for reporting this. We have passed this to the BSP team. This should be resolved in next release

0 Kudos
Visitor murphpo
Visitor
1,699 Views
Registered: ‎05-10-2017

Re: Bug in standalone.tcl

I'm disappointed to see that this bug remains in SDK 2017.3. Can you check that a CR was actually filed?

 

It's really frustrating to know the SDK is generating bad code for all MicroBlaze designs where exceptions are enabled, and that this bug has gone unfixed since 2016.3! Release 2017.3 even introduced an updated standalone BSP (now v6.4) without fixing this bug.

0 Kudos