Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial version of the UART driver #68

Merged
merged 27 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4af064e
firmware: drivers: uart: Creating uart header and source files #43
miguelboing Dec 26, 2022
6759186
firmware: drivers: uart: Init uart function #43
miguelboing Dec 28, 2022
ed9b2fd
firmware: Adding uart driver to compilation #43
miguelboing Dec 28, 2022
1bf1dcf
firmware: drivers: uart: Returning int in initialization #43
miguelboing Dec 29, 2022
a7b93a7
firmware: drivers: uart: Implementing send and receive byte functions…
miguelboing Dec 29, 2022
b0539b5
firmware: libs: Importing containers lib #43
miguelboing Dec 29, 2022
e599fe5
firmware: libs: containers: Adding separe rules #43
miguelboing Dec 30, 2022
c58f257
firmware: libs: containers: Fixing wrong pointer reference #43
miguelboing Dec 30, 2022
51c421f
firmware: drivers: uart: Adding all function declarations #43
miguelboing Dec 30, 2022
1ff641d
firmware: config: Adding initial error codes #44
miguelboing Jan 3, 2023
27d5614
firmware: Changing temporarily drivers rule #43
miguelboing Jan 5, 2023
8ea64c6
firmware: Adding stm32 family variable for opencm3 #24
miguelboing Feb 15, 2023
c50fad3
firmware: Removing unused main.cpp
miguelboing Feb 15, 2023
c1afa9a
firmware: drivers: uart: Code improvements #43
miguelboing Feb 15, 2023
196bbe9
firmware: Adding libs to compilation chain #24
miguelboing Feb 15, 2023
b3b0ac7
firmware: drivers: uart: Queue uart functions with code optimizations…
miguelboing Feb 15, 2023
7b10c81
firmware: config: Adding errno header file #44
miguelboing Feb 16, 2023
7b4613f
firmware: config: Adding metadata to the errno.h file #44
mgm8 Feb 17, 2023
6242bee
firmware: drivers: uart: RX enable/disable implementation #43
miguelboing Feb 28, 2023
d090bb3
firmware: drivers: uart: Changing data to type uint16 accordingly to …
miguelboing Feb 28, 2023
818bb23
firmware: libs: containers: Changing data type to uint16
miguelboing Feb 28, 2023
b99c190
firmware: drivers: uart: uart_write implementation #43
miguelboing Feb 28, 2023
73330ca
firmware: config: Fixing formatting #44
miguelboing Feb 28, 2023
7a810f9
firmware: drivers: uart: Implementing error code handling #43
miguelboing Feb 28, 2023
05c0113
firmware: drivers: uart: Fixing the code style and minor improvements…
mgm8 Jul 12, 2023
64e63cd
firmware: drivers: uart: Minor improvements and adding doxygen docume…
mgm8 Jul 12, 2023
b352c4c
Merge branch 'dev_firmware' into uart_feature
mgm8 Jul 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ifndef BUILD_DIR
endif

PARTNUMBER=stm32f103c8t6
OPENCM3_FAMILY=STM32F1

CC=arm-none-eabi-gcc
CPP=arm-none-eabi-g++
Expand All @@ -23,7 +24,7 @@ INC=.
CFLAGS=--static -nostartfiles -g3 -Os -fno-common -ffunction-sections -fdata-sections -I. -mcpu=cortex-m3 -mthumb -msoft-float

.PHONY: all
all: libopencm3_stm32f1.a crt.o main.o
all: libopencm3_stm32f1.a libs_rule drivers_rule crt.o main.o
$(LD) -T$(PARTNUMBER).ld $(BUILD_DIR)/*.o -o $(BUILD_DIR)/$(TARGET).elf -L$(BUILD_DIR)/ -lopencm3_stm32f1
$(OBJCOPY) -O binary $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).bin
$(SIZE) $(BUILD_DIR)/$(TARGET).elf
Expand All @@ -37,7 +38,7 @@ clean:
rm $(BUILD_DIR)/*.o $(BUILD_DIR)/*.a $(BUILD_DIR)/*.elf $(BUILD_DIR)/*.bin

main.o: main.c
$(CC) -c $(CFLAGS) -Ihal/include/ -DSTM32F1 $< -o $(BUILD_DIR)/$@
$(CC) -c $(CFLAGS) -Ihal/include/ -D$(OPENCM3_FAMILY) $< -o $(BUILD_DIR)/$@

crt.o: crt.s
$(AS) -o $@ $<
Expand All @@ -49,10 +50,9 @@ libopencm3_stm32f1.a: hal/Makefile
devices: devices/Makefile
$(MAKE) BUILD_DIR=$(BUILD_DIR) -C devices

drivers: drivers/Makefile
$(MAKE) BUILD_DIR=$(BUILD_DIR) -C drivers

libs: libs/Makefile
drivers_rule : drivers/Makefile
$(MAKE) BUILD_DIR=$(BUILD_DIR) OPENCM3_FAMILY=$(OPENCM3_FAMILY) -C drivers
libs_rule: libs/Makefile
$(MAKE) BUILD_DIR=$(BUILD_DIR) -C libs

os: os/Makefile
Expand Down
53 changes: 53 additions & 0 deletions firmware/config/errno.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* errno.h
*
* Copyright The SLCam Contributors.
*
* This file is part of SLCam.
*
* SLCam is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SLCam is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SLCam. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* \brief Errors definition.
*
* \author Miguel Boing <miguelboing13@gmail.com>
*
* \version 0.1.3
*
* \date 2023/02/16
*
* \defgroup errno Error Codes
* \{
*/

#ifndef ERRNO_H
#define ERRNO_H

/* No error ocurred */
#define ERRNO_SUCCESS 0x00U /** No errors found */

/* Driver Level errors */
#define ERRNO_DRIVER_NO_PORT 0x11U /** No port found */
#define ERRNO_DRIVER_NO_PARAMETER 0x12U /** Invalid parameter value */
#define ERRNO_DRIVER_FAILED 0x13U /** Failed to execute HAL function */

/* Device Level errors */
#define ERRNO_DEVICE_FAILED_CONFIG 0x21U /** Failed to configure driver */
#define ERRNO_DEVICE_FAILED_COM 0x22U /** Failed to communicate */

#endif /*ERRNO_H */

/** \} End of errno group */
5 changes: 3 additions & 2 deletions firmware/drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ endif

.PHONY: all
all:
$(MAKE) BUILD_DIR=$(BUILD_DIR) -C ov2640
$(MAKE) BUILD_DIR=$(BUILD_DIR) -C w25qxxx
# $(MAKE) BUILD_DIR=$(BUILD_DIR) -C ov2640
# $(MAKE) BUILD_DIR=$(BUILD_DIR) -C w25qxxx
$(MAKE) BUILD_DIR=$(BUILD_DIR) OPENCM3_FAMILY=$(OPENCM3_FAMILY) -C uart

.PHONY: clean
clean:
Expand Down
29 changes: 29 additions & 0 deletions firmware/drivers/uart/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
TARGET=uart

ifndef BUILD_DIR
BUILD_DIR=$(CURDIR)
endif

PARTNUMBER=stm32f103c8t6

CC=arm-none-eabi-gcc
CPP=arm-none-eabi-g++
AS=arm-none-eabi-as
LD=arm-none-eabi-ld
OBJCOPY=arm-none-eabi-objcopy
OBJDUMP=arm-none-eabi-objdump
READELF=arm-none-eabi-readelf
NM=arm-none-eabi-nm
SIZE=arm-none-eabi-size
GDB=arm-none-eabi-gdb

LIBS= -I../../ -I../../hal/include/
CFLAGS=-c -mcpu=cortex-m3 -mthumb -O0 $(LIBS) -D$(OPENCM3_FAMILY)

.PHONY: all
all:
$(CC) $(CFLAGS) $(TARGET).c -o $(BUILD_DIR)/$(TARGET).o

.PHONY: clean
clean:
rm $(BUILD_DIR)/*.o
Loading