Coder Social home page Coder Social logo

joshagirgis / make-wiring Goto Github PK

View Code? Open in Web Editor NEW

This project forked from earlz/make-wiring

0.0 0.0 0.0 24.95 MB

A copy of Arduino's wiring library with makefiles for easy building without the Arduino IDE FOR WINDOWS

Home Page: https://www.reddit.com/r/AskProgramming/comments/a19cdv/can_someone_show_me_how_to_implement_this_github/

Ruby 0.02% C++ 1.47% C 98.49% Assembly 0.02%
avr avrdude arduino-library ruby c-plus-plus

make-wiring's Introduction

make-wiring ported For Windows

Porting Earlz code to windows with adjustments and tweaks for functunality. the full thought process is posted here. https://www.reddit.com/r/AskProgramming/comments/a19cdv/can_someone_show_me_how_to_implement_this_github/

Requirements

Winavr: https://sourceforge.net/projects/winavr/

Usage

PREQS

Load your libaries (.c and .h files) in folders within the ./src directory.

Load your code (test.cpp) into the main directory.

Change settings in bin/settings.ini to the specific application.

With this repo you can:

Open command prompt window in the directory and run the below commands to compile code, compile libaries, and upload code to a generic AVR

Open monitor.exe and specify baud rate and com port to view a serial port. (you need to connect the TX RX pins to an FTDI)

Settings

Change settings in bin/settings.ini

For example: 16MHz Atmega644pa using libraries Wire EEPROM and Arduino. Using avrgcc, compiling test.cpp and uploading it to the avr with an stk500 programmer on COM17.

CODENAME=test ;without cpp
LIBS= EEPROM Wire avr Arduino;
PROGRAMMER = stk500 ;https://www.nongnu.org/avrdude/user-manual/avrdude_4.html
COMPORT=COM17
CPUFREQ="16000000UL"
MCU="atmega644pa"
PARTNO="m644p" ;https://www.nongnu.org/avrdude/user-manual/avrdude_4.html
VARIANT='standard' ;where to get the `pins_arduino.h` file
CFLAGS="-w -Os -Wl,--gc-sections -ffunction-sections -fdata-sections -std=c99"
CPPFLAGS="-w -Os -Wl,--gc-sections -ffunction-sections -fdata-sections"
ARFLAGS=""
SOURCES="src"
OUTPUTS="output"

CODENAME is your code's file name without the cpp. This code is located in the main directory

LIBS is the external libraries in the ./src directory. NOTE: make sure Arduino is last if using native arduino libraries like Wire or EEPROM.

PROGRAMMER defines the ICSP programmer being used

CPUFREQ is the Clock frequency your avr is to be used at (i.e 16MHz).

MCU is the name of the avr

PARTNO is another identifier for the avr

Variant is where the pins_arduino.h file is located. This will allow you to use the arduino macros. For example: it will allow you to refer to pin PB0 on the avr as digital pin '8'. Make sure this file is the correct variant if you want to use the arduino core.

Cflags and Cpp flags can be changed if needed

Command line interface

  1. build -- This will build and compile a specified library. It will first copy all the header files from every library to output/include. It then compiles all the libraries and then outputs the library binaries to the output/lib. If your libraries are interdependent try running build all so that all the header files get included. If there is an error in one library the command window will print the errors in the console.
  2. clean -- This will remove all the compiled .o files from the src directory. It will not remove files from the output directory
  3. rebuild -- will clean and then build
  4. compile -- compiles your .cpp file that is in the main directory. Errors will show in the command prompt.
  5. upload -- will compile and convert the built binary files, stored in the output directory, into a .hex file and use avrdude to upload to the specified AVR.

Usage is simple, if you are having trouble first make sure you have winAVR. List the command and then the library you wish to compile. List "all" if you want to compile all the libraries in ./src/

build command compiles all the .c and .cpp library files into .o files and .a files

./build.exe build arduino
./build.exe build Wire
./build.exe build all

Afterwards, you'll have the relevant header files and compiled binaries in the output/lib and output/include directory

clean command deletes all .o files

./build.exe clean arduino
./build.exe clean all

rebuild command cleans then builds

./build.exe rebuild arduino
	./build.exe rebuild all

Afterwards, you'll have the relevant header files and compiled binaries in the output/lib and output/include directory

compile command compiles your main code

./build.exe compile

Afterwards, you'll have the compiled binary in the output/codes directory

upload command will compile your main code and upload its .hex file to the avr.

./build.exe upload 

and the avr should reset and run the uploaded code

At any time the user can delete the ouput folder. Rebuilding will make a new one. Take a look at the ruby source code .bin/raw/build.rb if you want to understand the code more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.