示例#1
0
    def get_vector_catch(self, args):
        vector_catch = args.vector_catch.lower()

        # Handle deprecated options.
        if args.break_on_reset:
            vector_catch += 'r'
        if args.no_break_at_hardfault:
            # Must handle all case specially since we can't just filter 'h'.
            if vector_catch == 'all' or 'a' in vector_catch:
                vector_catch = 'bmiscpr'  # Does not include 'h'.
            else:
                vector_catch = vector_catch.replace('h', '')

        try:
            return convert_vector_catch(vector_catch)
        except ValueError as e:
            # Reraise as an invalid argument error.
            raise InvalidArgumentError(e.message)
示例#2
0
    def get_vector_catch(self, args):
        vector_catch = args.vector_catch.lower()

        # Handle deprecated options.
        if args.break_on_reset:
            vector_catch += 'r'
        if args.no_break_at_hardfault:
            # Must handle all case specially since we can't just filter 'h'.
            if vector_catch == 'all' or 'a' in vector_catch:
                vector_catch = 'bmiscpr' # Does not include 'h'.
            else:
                vector_catch = vector_catch.replace('h', '')

        try:
            return convert_vector_catch(vector_catch)
        except ValueError as e:
            # Reraise as an invalid argument error.
            raise InvalidArgumentError(e.message)
 def test_vc_b(self, vc, msk):
     assert convert_vector_catch(vc) == msk
 def test_all_b(self):
     assert convert_vector_catch(b'all') == Target.CATCH_ALL
 def test_none_b(self):
     assert convert_vector_catch(b'none') == 0
 def test_none_str(self):
     assert convert_vector_catch('none') == 0