Fault injection test method and apparatus, and fault injection method
View Patent ↗A fault injection test method of a fault injection test apparatus connected to a vehicle through a debugger is provided. The fault injection test method includes receiving fault injection conditions from a user; and setting the fault injection conditions using an on-chip debugging system (OCDS) module built into a central processing unit (CPU) of the vehicle controller.
1 . A method performed by a fault inject test apparatus, the method comprising:
receiving, by the fault injection test apparatus, fault injection conditions from a user, wherein the fault injection conditions comprise a fault injection location code address indicating a fault injection target; and
setting, by the fault injection test apparatus connected to a vehicle through a debugger, the fault injection conditions using an on-chip debugging system (OCDS) module built into a central processing unit (CPU) of a vehicle controller of the vehicle, wherein the setting the fault injection conditions comprises:
storing the fault injection location code address in a first debug register in the CPU; and
storing, in a second debug register in the CPU, a start address of a memory in the vehicle controller, wherein a trap function, defined for one of a plurality of fault modes, is stored at the start address, and wherein the trap function corresponds to the fault injection location code address, and
wherein a trigger signal is generated based on a program counter within the CPU matching the fault injection location code address of the first debug register, and wherein the OCDS module within the CPU calls the trap function in response to the trigger signal.
2 . The method of claim 1 , wherein the plurality of fault modes comprise two or more of: a task stop, a task miss, a variable manipulation, or a task overrun.
3 . The method of claim 1 , wherein
the fault injection conditions further comprise a fault mode, of the plurality of fault modes, to be injected into the fault injection target, and
wherein the method further comprises:
injecting, by the CPU of the vehicle controller executing the trap function, a fault of the fault mode into the fault injection target in the vehicle controller; and
monitoring an injection result of the fault.
4 . The method of claim 1 , wherein the storing the fault injection location code address comprises setting, by a hardware breakpoint in the OCDS module, the fault injection location code address in the first debug register.
5 . A fault injection test apparatus comprising:
one or more processors; and
memory storing instructions that, when executed by the one or more processors, cause the fault injection test apparatus to:
extract, based on an operating system (OS) software information file of a vehicle controller, fault injection location code addresses of fault injection targets from the vehicle controller;
store, using an on-chip debugging system (OCDS) module built into a central processing unit (CPU) of the vehicle controller, the fault injection location code addresses, of the fault injection targets designated by a user, in a first debug register inside the CPU of the vehicle controller; and
store, in a second debug register inside the CPU of the vehicle controller, a start address of a memory of the vehicle controller where a trap function, defined for one of a plurality of fault modes, is stored, wherein the trap function is for injecting a fault, corresponding to a fault mode designated by the user, into one of the fault injection targets, and
wherein a trigger signal is generated based on a program counter within the CPU matching the fault injection location code address of the first debug register, and wherein the OCDS module within the CPU calls the trap function in response to the trigger signal.
6 . The fault injection test apparatus of claim 5 , wherein the instructions, when executed by the one or more processors, further cause the fault injection test apparatus to:
monitor an injection result of the fault; and
inject, by the CPU of the vehicle controller executing the trap function, the fault of the fault mode designated by the user into the one of the fault injection targets in the vehicle controller.
7 . The fault injection test apparatus of claim 5 , wherein the fault injection location code addresses are set in the first debug register by a hardware breakpoint in the OCDS module.
8 . The fault injection test apparatus of claim 5 , wherein the plurality of fault modes comprise two or more of: a task stop, a task miss, a variable manipulation, or a task overrun.
9 . A method comprising:
setting, by a fault injection test apparatus and in a first debug register inside a central processing unit (CPU) of a vehicle controller, a fault injection location code address of a fault injection target designated by a user;
calling, from a memory of the vehicle controller and based on an address value of a program counter inside the CPU matching the fault injection location code address, a trap function to be executed, wherein the trap function corresponds to the fault injection location code address; and
executing the trap function to inject a fault, of a fault mode designated by the user, into the fault injection target,
wherein the calling the trap function comprises:
generating a trigger event based on the address value of the program counter matching the fault injection location code address; and
calling, by an on-chip debugging system (OCDS) module built into the CPU, the trap function based on the trigger event.
10 . The method of claim 9 , further comprising:
prior to the calling the trap function, storing, via the fault injection test apparatus, the trap function in the memory of the vehicle controller.
11 . The method of claim 9 , further comprising:
prior to the calling the trap function, setting, via the fault injection test apparatus, a start address of the memory where the trap function of the fault mode is stored in a second debug register inside the CPU,
wherein the calling the trap function comprises outputting the start address of the memory based on the trigger event.
12 . The method of claim 9 , wherein the trap function is defined for one of a plurality of fault modes.
13 . The method of claim 12 , wherein the plurality of fault modes comprise two or more of: a task stop, a task miss, a variable manipulation, or a task overrun.
14 . The method of claim 9 , wherein the trap function is stored at a start address of the memory.