atomclip / windows-arm-none-eabi

GNU Arm embedded toolchain for Windows
1 stars 0 forks source link

how to use this extension for Visual Studio Code #1

Closed xiaolongba closed 6 years ago

xiaolongba commented 6 years ago

Hi, @atomclip I dont know how to use this extension,can u give me some examples for reference?

lgmcode commented 6 years ago
  1. Generate a Makefile project from STM32CubeMX.
  2. Open that generated project folder with visual studio code.
  3. Add tasks.json to the .vscode folder, don't forget to change the "make test" to "make all".
  4. Press CTRL+SHIFT+B to build the project. Done!
xiaolongba commented 6 years ago

@lgmcode Great,so i dont need to install the app of "make for windows"?i can make all directly?right?

lgmcode commented 6 years ago

@xiaolongba The make.exe is in the bin directory, you don't need to install it again.

xiaolongba commented 6 years ago

@lgmcode Millions of thanks.let me have a try.u are a good man.

atomclip commented 6 years ago

@lgmcode,

Thank you for helping @xiaolongba. I added the make tool to enable cross platform build with only the bare metal tools.

xiaolongba commented 6 years ago

@atomclip , if the makefile of my project need to specify the toolchain path,what should i do?

atomclip commented 6 years ago

The extension has three paths for the toolchain. You can use this in the tasks.json.

arm-none-eabi.bin arm-none-eabi.include arm-none-eabi.lib

You can add the rest of the path in tasks.json or your make file.

This is what I use in the make file at the moment for a Cortex M0

lib_path = ${LIB}/gcc/arm-none-eabi/7.3.1/thumb/v6-m/ lib = $(lib_path)libgcc.a

xiaolongba commented 6 years ago

@atomclip Thanks for your help.Maybe u misunderstood what i meant.i mean that how to specify my own project's makefile after i install the extension of windows-arm-none-eabi,i want to use the path of the extension toolchain in my makefile,is it possible?

atomclip commented 6 years ago

@xiaolongba

On Windows visual studio code extensions are installed on the location:

C:\User\USERNAME\.vscode\extensions\EXTENSION_NAME

See the example below. My name is "Carl" and the extension name "atomclip.windows-arm-none-eabi-0.1.0"

image

To create a makefile that is independent of the name of the user, the version of the extension and the operating system I made three visual studio code variables. The names of these variables are:

arm-none-eabi.bin arm-none-eabi.include arm-none-eabi.lib

In my case the variable ${config:arm-none-eabi.bin} in the task.json expands to

C:\Users\Carl\.vscode\extensions\atomclip.windows-arm-none-eabi-0.1.0\bin

As you can see in the example task.json I added this path to the environment variable PATH. Now Windows is able to find make.exe which I copied to the bin directory for convenience.

If you like to call any of the tools from the toolchain from the command prompt or Windows PowerShell you need to add the search path to the PATH environment variable.

See this example: https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

There is a catch here. Visual studio code uses the version number of the extension in the path. If the extension is updated visual studio code leaves the old version on you computer. If you forget to update the PATH it still points to the previous version. So be warned.

Happy coding

xiaolongba commented 6 years ago

@atomclip Great!I tried the method what you said and it works well now.Thanks for your help,bro.u are a good man.