A
A
allsettingsdone2014-10-20 01:07:28
Programming
allsettingsdone, 2014-10-20 01:07:28

How to compile a simple project for ARM STM32 in Sublime Text 3?

I installed the compiler "GNU Tools ARM Embedded" and Make, PATH was added to the system, here is the contents of the st3.sublime-project project file:

{
  "folders":
  [
    {
      "follow_symlinks": true,
      "path": "."
    }
  ],

"build_systems":
  [
    {
      "name": "ARM build",
      "cmd": ["make"],
      "working_dir": "${project_path}"
    }
  ]
}

Trying to compile main.cpp:
int main(void)
{
  while(1)
  {
    
  }
}

When I try to compile, the console says:
arm-none-eabi-gcc main.cpp
[Finished in 0.4s with exit code 2]
[cmd: ['make']]
[dir: X:\st3]
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status
make: *** [all] Error 1

I am using this makefile:
TARGET = arm-none-eabi-

CHIP = STM32F0XX

LDSCRIPT = STM32F030x6.ld

all:
  arm-none-eabi-gcc main.cpp

What could be the problem? I think the problem is that the compiler doesn't take or see "startup_stm32f10x_md_vl.s".
Here is the attached project: https://copy.com/u4vtHeATYVaweCc7

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Drimler, 2014-10-20
@Drimler

perhaps the code itself needs to be corrected - for example: int main() {..}on void main() {..}well or return after the cycle to push ..
I don’t remember exactly, but the error strongly resembles something like that ..

A
allsettingsdone, 2014-10-25
@allsettingsdone

In general, the problem is on the way to its exhaustion. I just tried using a newer version of make.exe (4.1 vs 3.81) and when I build I get this:

makefile:296: warning: overriding recipe for target '.'
makefile:293: warning: ignoring old recipe for target '.'
makefile:299: warning: overriding recipe for target '.'
makefile:296: warning: ignoring old recipe for target '.'
makefile:302: warning: overriding recipe for target '.'
makefile:299: warning: ignoring old recipe for target '.'
--- building test1. defines: -DSTM32F030x6 -DVER_MAJOR=0 -DVER_MINOR=1 -DHSE_VALUE=8000000
makefile:296: warning: overriding recipe for target '.'
makefile:293: warning: ignoring old recipe for target '.'
makefile:299: warning: overriding recipe for target '.'
makefile:296: warning: ignoring old recipe for target '.'
makefile:302: warning: overriding recipe for target '.'
makefile:299: warning: ignoring old recipe for target '.'
makefile:296: warning: overriding recipe for target '.'
makefile:293: warning: ignoring old recipe for target '.'
makefile:299: warning: overriding recipe for target '.'
makefile:296: warning: ignoring old recipe for target '.'
makefile:302: warning: overriding recipe for target '.'
makefile:299: warning: ignoring old recipe for target '.'
--- compiling main.cpp...
--- linking...
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: warning: cannot find entry symbol Reset_Handler; defaulting to 08000000
makefile:296: warning: overriding recipe for target '.'
makefile:293: warning: ignoring old recipe for target '.'
makefile:299: warning: overriding recipe for target '.'
makefile:296: warning: ignoring old recipe for target '.'
makefile:302: warning: overriding recipe for target '.'
makefile:299: warning: ignoring old recipe for target '.'
--- make hex...
makefile:296: warning: overriding recipe for target '.'
makefile:293: warning: ignoring old recipe for target '.'
makefile:299: warning: overriding recipe for target '.'
makefile:296: warning: ignoring old recipe for target '.'
makefile:302: warning: overriding recipe for target '.'
makefile:299: warning: ignoring old recipe for target '.'
--- making asm-lst...
   text	   data	    bss	    dec	    hex	filename
      0	      0	    768	    768	    300	./test1.elf
"Errors: none"
[Finished in 0.6s]

This creates the following files: main.d, main.lst, main.o, test1.elf, test1.hex, test1.lss, test1.map.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question