Skip to content

Commit

Permalink
Merge pull request #41 from spacelab-ufsc/dev
Browse files Browse the repository at this point in the history
Dev: Release v0.1.3
  • Loading branch information
mgm8 authored Dec 12, 2022
2 parents 92c30ea + e03b577 commit 74525bc
Show file tree
Hide file tree
Showing 2,654 changed files with 1,065,484 additions and 1,392 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

6 changes: 6 additions & 0 deletions firmware/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ tags
# CppCheck files
*.ctu-info
cppcheck-addon-ctu-file-list

# Compilation Files
*.o
*.a
*.bin
*.elf
1 change: 1 addition & 0 deletions firmware/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
# source control.

Gabriel Mariano Marcelino <gabriel.mm8@gmail.com>
Miguel Boing <miguelboing13@gmail.com>
7 changes: 7 additions & 0 deletions firmware/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
===========================================

v0.1.3 - 2022/12/12

- libopencm3 imported and integrated
- Blink LED example compiling and running

===========================================

v0.1 - 2022/08/14

- Initial project structure
Expand Down
36 changes: 21 additions & 15 deletions firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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
Expand All @@ -19,41 +20,46 @@ GDB=arm-none-eabi-gdb
FLASH=st-flash

INC=.
CFLAGS=-mcpu=cortex-m3 -mthumb -O0
CFLAGS=--static -nostartfiles -g3 -Os -fno-common -ffunction-sections -fdata-sections -I. -mcpu=cortex-m3 -mthumb -msoft-float

.PHONY: all
all: main.o devices drivers hal libs os system tasks
$(LD) -T$(PARTNUMBER).ld $(BUILD_DIR)/*.o -o $(BUILD_DIR)/$(TARGET).elf
all: libopencm3_stm32f1.a 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

.PHONY: flash
flash:
$(FLASH)
$(FLASH) --reset write $(BUILD_DIR)/$(TARGET).bin 0x08000000

.PHONY: clean
clean:
rm $(BUILD_DIR)/*.o $(BUILD_DIR)/*.elf $(BUILD_DIR)/*.bin
rm $(BUILD_DIR)/*.o $(BUILD_DIR)/*.a $(BUILD_DIR)/*.elf $(BUILD_DIR)/*.bin

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

devices:
crt.o: crt.s
$(AS) -o $@ $<

libopencm3_stm32f1.a: hal/Makefile
$(MAKE) BUILD_DIR=$(BUILD_DIR) TARGETS='stm32/f1' -C hal
mv hal/lib/libopencm3_stm32f1.a $(BUILD_DIR)/

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

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

hal:
$(MAKE) BUILD_DIR=$(BUILD_DIR) -C hal

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

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

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

tasks:
tasks: tasks/Makefile
$(MAKE) BUILD_DIR=$(BUILD_DIR) -C tasks
130 changes: 130 additions & 0 deletions firmware/config/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* FreeRTOS Kernel V10.5.1
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/


/* The following #error directive is to remind users that a batch file must be
* executed prior to this project being built. The batch file *cannot* be
* executed from within CCS4! Once it has been executed, re-open or refresh
* the CCS4 project and remove the #error line below.
*/
//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above.


#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/

#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( 32000000UL )
#define configLFXT_CLOCK_HZ ( 32768L )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 75 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 20 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configGENERATE_RUN_TIME_STATS 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1

#ifdef __LARGE_DATA_MODEL__
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 100 )
#else
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 150 )
#endif

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 3 )
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 0
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1

/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 4 /* 15 priority levels */
#endif

/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf

/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5

/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }

/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names. */
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler

#endif /* FREERTOS_CONFIG_H */
9 changes: 9 additions & 0 deletions firmware/crt.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.cpu cortex-m3
.thumb
// end of 20K RAM
.word 0x20005000
.word _reset
.thumb_func
_reset:
bl main
b .
12 changes: 12 additions & 0 deletions firmware/drivers/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ifndef BUILD_DIR
BUILD_DIR=$(CURDIR)
endif

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

.PHONY: clean
clean:
rm $(BUILD_DIR)/*.o
5 changes: 4 additions & 1 deletion firmware/drivers/drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <gabriel.mm8@gmail.com>
*
* \version 0.0.0
* \version 0.1.2
*
* \date 2022/07/10
*
Expand All @@ -36,6 +36,9 @@
#ifndef DRIVERS_H_
#define DRIVERS_H_

#include "ov2640/ov2640.h"
#include "w25qxx/src/driver_w25qxx.h"

#endif /* DRIVERS_H_ */

/** \} End of drivers group */
27 changes: 27 additions & 0 deletions firmware/drivers/ov2640/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
TARGET=ov2640

ifndef BUILD_DIR
BUILD_DIR=$(CURDIR)
endif

PARTNUMBER=stm32f103c8t6

CC=arm-none-eabi-gcc
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

CFLAGS=-c -mcpu=cortex-m3 -mthumb -O0

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

.PHONY: clean
clean:
rm $(BUILD_DIR)/*.o
1 change: 1 addition & 0 deletions firmware/drivers/ov2640/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# OV2640 Driver
32 changes: 22 additions & 10 deletions firmware/hal/hal.h → firmware/drivers/ov2640/ov2640.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* hal.h
* ov2640.c
*
* Copyright The SLCam Contributors.
*
Expand All @@ -16,26 +16,38 @@
* 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/>.
* along with SLCam. If not, see <http:/\/www.gnu.org/licenses/>.
*
*/

/**
* \brief HAL definition.
* \brief OV2640 driver implementation.
*
* \author Gabriel Mariano Marcelino <gabriel.mm8@gmail.com>
*
* \version 0.0.0
* \version 0.1.1
*
* \date 2022/07/10
* \date 2022/08/19
*
* \defgroup hal HAL
* \addtogroup ov2640
* \{
*/

#ifndef HAL_H_
#define HAL_H_
#include "ov2640.h"

#endif /* HAL_H_ */
int ov2640_init(void)
{
return -1;
}

/** \} End of hal group */
int ov2640_read_reg(uint8_t adr, uint8_t *val)
{
return -1;
}

int ov2640_write_reg(uint8_t adr, uint8_t val)
{
return -1;
}

/** \} End of ov2640 group */
Loading

0 comments on commit 74525bc

Please sign in to comment.