Skip to content

Commit 69f82c6

Browse files
authored
Merge pull request #58 from CU-Robotics/feature-SD-lib
Adds library source back and adds SD card library
2 parents ba96679 + 37d75f0 commit 69f82c6

File tree

250 files changed

+59400
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+59400
-17
lines changed

Makefile

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ TEENSY_LIB = teensy4
1313

1414
# Used external libraries
1515
LIBRARY_DIR = libraries
16-
# this is where you add your new library to, add it's path with a '-I' attached to the front
17-
LIBRARY_INCLUDE = -Ilibraries/Adafruit_BusIO -Ilibraries/Adafruit_ICM20X -Ilibraries/Adafruit_LIS3MDL -Ilibraries/Adafruit_LSM6DS -Ilibraries/Adafruit_Sensor -Ilibraries/FlexCAN_T4 -Ilibraries/FreqMeasureMulti -Ilibraries/SPI -Ilibraries/unity -Ilibraries/Wire -Ilibraries/VL53L4CD
16+
LIBRARY_SOURCE_C = $(shell find $(LIBRARY_DIR) -name "*.c")
17+
LIBRARY_SOURCE_CPP = $(shell find $(LIBRARY_DIR) -name "*.cpp")
18+
19+
LIBRARY_INCLUDE = -Ilibraries/Adafruit_BusIO -Ilibraries/Adafruit_ICM20X -Ilibraries/Adafruit_LIS3MDL -Ilibraries/Adafruit_LSM6DS -Ilibraries/Adafruit_Sensor -Ilibraries/FlexCAN_T4 -Ilibraries/FreqMeasureMulti -Ilibraries/SPI -Ilibraries/unity -Ilibraries/Wire -Ilibraries/VL53L4CD -Ilibraries/SD -Ilibraries/SdFat -Ilibraries/SdFat/src
20+
1821
# name of the output lib file
1922
LIBRARY_LIB_NAME = liblibs.a
2023
# lib file name stripped of initial 'lib' and '.a'
@@ -28,8 +31,7 @@ PROJECT_INCLUDE = src
2831
PROJECT_NAME = firmware
2932

3033
# Teensy41 compiler flags
31-
TEENSY4_FLAGS = -DF_CPU=600000000 -DUSB_RAWHID -DLAYOUT_US_ENGLISH -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO_TEENSY41
32-
34+
TEENSY4_FLAGS = -DF_CPU=600000000 -DUSB_RAWHID -DLAYOUT_US_ENGLISH -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO_TEENSY41 -DARDUINO=200
3335
# CPU flags to tailor the code for the Teensy processor
3436
CPU_FLAGS = -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb
3537

@@ -65,7 +67,7 @@ OBJCOPY := $(ARDUINO_PATH)/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/ar
6567
GIT_SCRAPER = ./tools/git_scraper.cpp
6668

6769
# targets are phony to force it to rebuild every time
68-
.PHONY: build upload monitor kill git_scraper clean_objs clean_bin clean
70+
.PHONY: build upload monitor kill restart clean clean_objs clean_bin rebuild_libs lib_all lib_teensy lib_libs clean_libs
6971
.DEFAULT_GOAL = build
7072

7173
# builds source, links with libraries, and constructs the .hex to be uploaded
@@ -118,3 +120,31 @@ clean_bin:
118120
# overall clean target
119121
clean: clean_objs clean_bin
120122

123+
rebuild_libs: clean_libs lib_all
124+
125+
lib_all: lib_teensy lib_libs
126+
127+
lib_teensy:
128+
@echo [Building Teensy Core CPP]
129+
@$(COMPILER_CPP) $(COMPILE_FLAGS) $(CPP_FLAGS) -c $(TEENSY_DIR)/*.cpp $(TEENSY_INCLUDE)
130+
@echo [Building Teensy Core C]
131+
@$(COMPILER_C) $(COMPILE_FLAGS) -c $(TEENSY_DIR)/*.c $(TEENSY_INCLUDE)
132+
@echo [Assembling Static Library]
133+
@ar rcs $(TEENSY_LIB_NAME) *.o
134+
@echo [$(TEENSY_LIB_NAME) Created in $(PROJECT_DIR)]
135+
@rm *.o -f
136+
@echo [Cleaning Up]
137+
138+
lib_libs:
139+
@echo [Building Libraries C]
140+
@$(COMPILER_C) $(COMPILE_FLAGS) -c $(LIBRARY_SOURCE_C) $(LIBRARY_INCLUDE) $(TEENSY_INCLUDE)
141+
@echo [Building Libraries CPP]
142+
@$(COMPILER_CPP) $(COMPILE_FLAGS) $(CPP_FLAGS) -c $(LIBRARY_SOURCE_CPP) $(LIBRARY_INCLUDE) $(TEENSY_INCLUDE)
143+
@echo [Assembling Static Library]
144+
@ar rcs $(LIBRARY_LIB_NAME) *.o
145+
@echo [$(LIBRARY_LIB_NAME) Created in $(PROJECT_DIR)]
146+
@rm *.o -f
147+
@echo [Cleaning Up]
148+
149+
clean_libs:
150+
@rm *.a -f

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ You can find our documentation guidelines at [docs/README](docs/README.md), and
99
## Installation
1010
To begin, clone the repository:
1111
```bash
12-
git clone https://gitlab.com/cu-robotics/firmware.git
12+
git clone https://github.com/cu-robotics/firmware.git
1313
```
1414

1515
Then, install dependencies:
@@ -20,11 +20,7 @@ git config --local core.hooksPath .githooks
2020
```
2121

2222
If the files `liblibs.a` and `libsteensy4.a` do not exist in the core directory, follow these steps.
23-
* Checkout the branch `lib-source`
24-
* Run `make`
25-
* Store the resulting library files `liblibs.a` and `libteensy4.a` to some tempory location outside of the repository
26-
* Return to your old branch (or `main`)
27-
* Copy those library files into the core directory
23+
* Run `make lib_all`
2824

2925
## Usage
3026

@@ -54,3 +50,6 @@ This repo follows the CU Robotics code standard:
5450
- `patch` branches are named `patch-[patchname]` and contain bugfixes and/or minor adjustments. Unit and integration testing is a soft requirement.
5551
- All software is required to pass formatting and build tests before being merged into a `production` branch.
5652
- Other branch-based style questions are answered in the [style guide](docs/README.md).
53+
54+
## Licensing
55+
This repository uses the MIT License, which covers the code and tools written for our robot firmware. See separate copyright/licensing information for the external libraries used in the repo (in the libaries/ and teensy4/ directories).

0 commit comments

Comments
 (0)