2.2 SDD Description 작성 과정

💡

SWUD에서 SDD 산출물을 자동으로 생성할 때, 코드 상의 주석을 자동으로 입력할 수 있다.

  • Root 클릭, Context Menu에서 SW Unit Design > Perform Comment Reverse Engineering 클릭

이때, 아래와 같은 주석 작성 규칙을 지켜야 산출물에 반영된다.

Function (함수)

⚠️

.h 에서 정의된 함수의 경우 (선언부)

// 주석 Type1
// _@<function name>: adc_process1 is xxx function.

// 주석 Type2
/* _@<function name>:
** adc_process1 is xxx function.
*/

// 주석 Type3
/* _@<function name>:
adc_process1 is xxx function.
*/

⚠️

.c 에서 정의된 함수의 경우 (정의부)

  • 선언부와 정의부가 둘 다 작성되어 있는 .c 파일의 경우 정의부에만 작성한다.

  • Argument의 [direction]은 In / Out / InOut 으로 권장한다.

/* _@demoFunction:
****************************************************************************************
** ASIL				:	<Level;B>																	
** Related ID		:	<Related ID;SRS-003, SRS-005>													
** Description		:	<function description;adc_process2 is yyy function>
**							<2nd Description>
**							<3rd Description>
** Argument :
**       arg1[In] : <arg1 argument description>
**       arg2[Out] : <arg2 argument description>
**       arg3[InOut] : <arg3 argument description>
*****************************************************************************************/
void demoFunction(uint8 arg1, uint8* arg2, uint8* arg3) {
	uint8 testSum;
	testSum = arg1 + *arg3;
	*arg2 = testSum;
	*arg3 = arg1;
  uint8 retVal;
}

Struct (구조체)

// 주석 Type1
/* _@st_DemoDescription:
** st_DemoDescription description
** A : member A description
** B : member B description
*/
struct st_DemoDescription {
  uint8 A;
  uint8 B;
};

// 주석 Type2
/* _@st_DemoDescription:
st_DemoDescription description
A : member A description
B : member B description
*/
struct st_DemoDescription {
  uint8 A;
  uint8 B;
};

// 주석 Type3
/* _@st_DemoDescription:
   st_DemoDescription description
** A : member A description
** B : member B description
*/
struct st_DemoDescription {
  uint8 A;
  uint8 B;
};

Union (공용체)

// 주석 Type1
/* _@uni_DemoDescription:
** st_DemoDescription description
** A : member A description
** B : member B description
*/
union uni_DemoDescription {
  uint8 A;
  uint8 B;
}

// 주석 Type2
/* _@uni_DemoDescription:
st_DemoDescription description
A : member A description
B : member B description
*/
union uni_DemoDescription {
  uint8 A;
  uint8 B;
}

// 주석 Type3
/* _@uni_DemoDescription:
st_DemoDescription description
** A : member A description
** B : member B description
*/
union uni_DemoDescription {
  uint8 A;
  uint8 B;
}

variable (변수)

// 주석 Type1
// _@demoValue1: demoValue1 description
uint8 demoValue1;

// 주석 Type2
/* _@demoValue2:
** demoValue2 description
*/
uint8 demoValue2;

// 주석 Type3
/* _@demoValue3:
demoValue2 description
*/
uint8 demoValue3;

Macro (매크로)

// 주석 Type1
// _@DEMOMACRO1: DEMOMACRO1 description
#define DEMOMACRO1 0

// 주석 Type2
/* _@DEMOMACRO2:
** DEMOMACRO2 description
*/
#define DEMOMACRO2 1

// 주석 Type3
/* _@DEMOMACRO3:
DEMOMACRO3 description
*/
#define DEMOMACRO3 2

Enumeration

// 주석 Type1 
// _@valueOption: valueOpiton description
enum valueOption {
    VAL_START = 0,
    VAL_STOP,
    VAL_CONTINUE = 3,
    VAL_REPEAT
};

// 주석 Type2
/* _@valueOption: valueOpiton description
**                second line
** VAL_START: Description of VAL_START
** VAL_STOP: Description of VAL_STOP
** VAL_CONTINUE: Description of CONTINUE
** VAL_REPEAT: Description of REPEAT
*/
enum valueOption {
    VAL_START = 0,
    VAL_STOP,
    VAL_CONTINUE = 3,
    VAL_REPEAT
};

// 주석 Type3
/* _@valueOption: valueOpiton description
                  second line
   VAL_START: Description of VAL_START
   VAL_STOP: Description of VAL_STOP
   VAL_CONTINUE: Description of CONTINUE
   VAL_REPEAT: Description of REPEAT             
*/
enum valueOption {
    VAL_START = 0,
    VAL_STOP,
    VAL_CONTINUE = 3,
    VAL_REPEAT
};

Typedef (타입정의)

// 주석 Type1
// _@RetValue: RetValue description
typedef uint8 RetValue;

// 주석 Type2
/* _@RetValue:
** RetValue description
*/
typedef uint8 RetValue;

// 주석 Type3
/* _@RetValue:
RetValue description
*/
typedef uint8 RetValue;