def setup(self, bl, request):
        common_util.reset_with_check(bl)
        common_util.erase_all_available_flash(bl)

        def teardown():
            common_util.erase_all_available_flash_unsecure(bl)

        request.addfinalizer(teardown)
    def setup(self, request, bl):
        if bl.target.bootloaderType == bootsources.kBootROM_ExecuteROM:
            bl.target.unlock()
            common_util.reset_without_check(bl)
            # erase all the flash to let flash 0x40c be 1s
            common_util.erase_all_available_flash(bl)
        else:
            pytest.skip("This case only supports on ROM-resident bootloader.")

        def teardown():
            # We should use JLink to unlock the device so that JLink can connect with the device and reset the device.
            bl.target.unlock()

        request.addfinalizer(teardown)