본문 바로가기

컴퓨터 과학 & 영상처리 관련/임베디드

arm에서 문자열 상수 메모리 할당법?

start.S

_string:
         .string "hello world"


------------------------------------------------------
timer.dis

82000140 <_string>:
82000140:   6c6c6568   .word   0x6c6c6568
82000144:   6f77206f   .word   0x6f77206f
82000148:   00646c72   .word   0x00646c72

------------------------------------------------------

char - ASKII값 - hex값

'h' - 104 - 68
'e' - 101 - 65
'l' - 108 - 6c
'l' - 108 - 6c
'o' - 111 - 6f
' ' - 32 - 20
'w' - 119 - 77
'o' - 111 - 6f
'r' - 114 - 72
'l' - 108 - 6c
'd' - 100 - 64

'\0' - 0 - 00
------------------------------------------------------
_string:
.string "hello world\0"
로 할당을 하고 컴파일을 하면

82000140 <_string>:
82000140: 6c6c6568 .word 0x6c6c6568
82000144: 6f77206f .word 0x6f77206f
82000148: 00646c72 .word 0x00646c72
...

이렇게 되는데 요건 멀까?
하기야 아직 스트링 출력같은거 함수를 만든것도 아니라...되는지 안되는지 잘 모르겠다

UART_printf()나 UART_putc()로 출력을 하게 만들어야겠네