This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] 编译器/MSP430G2553:如何在不链接运行时库的情况下使用 MSP430-GCC-opensource 编译代码?

Guru**** 2194400 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/724522/compiler-msp430g2553-how-to-compile-code-with-msp430-gcc-opensource-without-linking-run-time-library

器件型号:MSP430G2553

工具/软件:TI C/C++编译器

我的代码工作正常、但需要额外的~ 700字节。 我不是 gcc 专家。 如何不链接运行时库?

代码:

#include 

int main (void){

WDTCTL = WDTPW | WDTHOLD;

P1DIR = BIT0;
P1OUT = BIT0;

while (1);//从不退出

} 

编译命令行:msp430-elf-gcc -O2 -g mycode.c -o mycode.o

objdump 结果:

反汇编.text 段:

0000c00c <__crt0_start>:
   c00c:31 40 00 04 mov #1024、R1;#0x0400

0000c010 <__crt0_init_bss>:
   C010:3c 40 02 02 mov #514、R12;#0x0202

(笑声) (笑声) (笑声) (笑声)