0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

STM32CubeIDEを使ってみよう How To STM32CubeIDE 日本語版 Optimization Levelを変更して最適化する

Posted at

STM32CubeIDEで以下のようなエラーが出た人はいないでしょうか?

c:\st\stm32cubeide_1.3.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.4.0.202007081208\tools\arm-none-eabi\bin\ld.exe: region `FLASH' overflowed by 944 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:54: STM32F042-1.elf] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.

11:53:58 Build Failed. 3 errors, 1 warnings. (took 10s.509ms)

Keyboard-1-1.jpg
フラッシュにファイルが入らないというエラーになります。
最適化して入るようにしてみましょう。(すべてではありません)

右クリック⇒Properties

image.png

C/C++ Build⇒Tool Settings⇒MCU GCC Compoler⇒Optimization
image.png

Optimization levelを変更する

arm-none-eabi-objdump -h -S  STM32F042-1.elf  > "STM32F042-1.list"
arm-none-eabi-objcopy  -O binary  STM32F042-1.elf  "STM32F042-1.bin"
arm-none-eabi-size   STM32F042-1.elf 
   text	   data	    bss	    dec	    hex	filename
  17928	    364	   3780	  22072	   5638	STM32F042-1.elf
Finished building: default.size.stdout
 
Finished building: STM32F042-1.bin
 
Finished building: STM32F042-1.list
 

11:58:13 Build Finished. 0 errors, 1 warnings. (took 9s.209ms)

以上でコンパイルが通るようになります。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?