Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fauxstess-cupcake'
Browse files Browse the repository at this point in the history
Conflicts:
	README.md
  • Loading branch information
nkming2 committed Jan 17, 2015
2 parents 89543ff + c656a5e commit 39b0662
Show file tree
Hide file tree
Showing 197 changed files with 3,650 additions and 1,349 deletions.
16 changes: 11 additions & 5 deletions MakeConfig.inc
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
ifeq ($(SCCC_CONFIG),INNO)
BIN_SUFFIX:=$(BIN_SUFFIX)-inno
CPPFLAGS+=-DK60_INNO
CPPFLAGS+=-DK60_INNO=1
SCCC_MCU=MK60DZ10
$(info Config = INNO)

else ifeq ($(SCCC_CONFIG),2014_CAMERA)
BIN_SUFFIX:=$(BIN_SUFFIX)-2014-camera
CPPFLAGS+=-DK60_2014_CAMERA
CPPFLAGS+=-DK60_2014_CAMERA=1
SCCC_MCU=MK60DZ10
$(info Config = 2014_CAMERA)

else ifeq ($(SCCC_CONFIG),2014_CCD)
BIN_SUFFIX:=$(BIN_SUFFIX)-2014-ccd
CPPFLAGS+=-DK60_2014_CCD
CPPFLAGS+=-DK60_2014_CCD=1
SCCC_MCU=MK60DZ10
$(info Config = 2014_CCD)

else ifeq ($(SCCC_CONFIG),2014_INNO)
BIN_SUFFIX:=$(BIN_SUFFIX)-2014-inno
CPPFLAGS+=-DK60_2014_INNO
CPPFLAGS+=-DK60_2014_INNO=1
SCCC_MCU=MK60DZ10
$(info Config = 2014_INNO)

else ifeq ($(SCCC_CONFIG),2014_MAGNETIC)
BIN_SUFFIX:=$(BIN_SUFFIX)-2014-magnetic
CPPFLAGS+=-DK60_2014_MAGNETIC
CPPFLAGS+=-DK60_2014_MAGNETIC=1
SCCC_MCU=MK60DZ10
$(info Config = 2014_MAGNETIC)

else ifeq ($(SCCC_CONFIG),VCAN_FX15DEV)
BIN_SUFFIX:=$(BIN_SUFFIX)-vcan-fx15dev
CPPFLAGS+=-DK60_VCAN_FX15DEV=1
SCCC_MCU=MK60F15
$(info Config = VCAN_FX15DEV)

else
$(error Missing/Unknown config '$(SCCC_CONFIG)' (set SCCC_CONFIG))

Expand Down
30 changes: 25 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ CCFLAGS+=-Wall -Wextra

ifeq ($(SCCC_BUILD),DEBUG)
BIN_SUFFIX:=$(BIN_SUFFIX)-d
CPPFLAGS+=-DDEBUG
CPPFLAGS+=-DDEBUG=1
CCFLAGS+=-O0 -g3
$(info Build = DEBUG)

else ifeq ($(SCCC_BUILD),RELEASE)
BIN_SUFFIX:=$(BIN_SUFFIX)-r
CPPFLAGS+=-DRELEASE -DNDEBUG
CPPFLAGS+=-DRELEASE=1 -DNDEBUG
CCFLAGS+=-O2 -g0
$(info Build = RELEASE)

else
$(warning Unknown build type, defaulting to DEBUG (set SCCC_BUILD))
BIN_SUFFIX:=$(BIN_SUFFIX)-d
CPPFLAGS+=-DDEBUG
CPPFLAGS+=-DDEBUG=1
CCFLAGS+=-O0 -g3
$(info Build = DEBUG)

Expand All @@ -78,17 +78,23 @@ endif
include MakeConfig.inc

ifeq ($(SCCC_MCU),MK60DZ10)
CPPFLAGS+=-DMK60DZ10
CPPFLAGS+=-DMK60DZ10=1
CCFLAGS+=-mthumb -mthumb-interwork -mcpu=cortex-m4
CCFLAGS+=-msoft-float -mfloat-abi=soft
$(info MCU sub-family = MK60DZ10)

else ifeq ($(SCCC_MCU),MK60D10)
CPPFLAGS+=-DMK60D10
CPPFLAGS+=-DMK60D10=1
CCFLAGS+=-mthumb -mthumb-interwork -mcpu=cortex-m4
CCFLAGS+=-msoft-float -mfloat-abi=soft
$(info MCU sub-family = MK60D10)

else ifeq ($(SCCC_MCU),MK60F15)
CPPFLAGS+=-DMK60F15=1
CCFLAGS+=-mthumb -mthumb-interwork -mcpu=cortex-m4
CCFLAGS+=-mfpu=fpv4-sp-d16 -mfloat-abi=hard
$(info MCU sub-family = MK60F15)

else
$(error Missing/Unknown MCU identifier '$(SCCC_MCU)' (set SCCC_MCU))

Expand Down Expand Up @@ -125,6 +131,20 @@ SRC_FILES:=$(shell find $(SRC_PATH) -type f -name *.c -o -name *.S -o -name *.cp

endif

not_contain=$(foreach v,$2,$(if $(findstring $1,$v),,$v))
SRC_FILES:=$(call not_contain,/pinout/,$(SRC_FILES))

ifeq ($(SCCC_MCU),MK60DZ10)
SRC_FILES+=$(SRC_PATH)/libbase/k60/pinout/mk60d10_lqfp144.cpp

else ifeq ($(SCCC_MCU),MK60D10)
SRC_FILES+=$(SRC_PATH)/libbase/k60/pinout/mk60d10_lqfp144.cpp

else ifeq ($(SCCC_MCU),MK60F15)
SRC_FILES+=$(SRC_PATH)/libbase/k60/pinout/mk60f15_lqfp144.cpp

endif

OBJ_FILES:=$(SRC_FILES:$(SRC_PATH)/%.c=$(OUT_OBJ_PATH)/%.o)
OBJ_FILES:=$(OBJ_FILES:$(SRC_PATH)/%.S=$(OUT_OBJ_PATH)/%.o)
OBJ_FILES:=$(OBJ_FILES:$(SRC_PATH)/%.cpp=$(OUT_OBJ_PATH)/%.o)
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
libsccc
==============

libsccc (previously libsmartcarcpp) is the library being used among the HKUST SmartCar Team.
Master is the stable branch. Current developments are being done mainly on [fauxstess-cupcake](https://github.com/hkust-smartcar/libsccc/tree/fauxstess-cupcake), but also various other branches.
libsccc (previously libsmartcarcpp) is the library being used among the HKUST SmartCar Team

## What's Inside
libbase: K60 peripheral library
libbase: Peripheral library for MK60D(Z)10, MK60F15(/12)
libsc: High-level component library based on libbase
libutil: Useful utilities
libutil: Useful utilities

## Dependency
None

## Build
GNU Make, [GNU Tools for ARM Embedded Processor](https://launchpad.net/gcc-arm-embedded)
GNU Make 3.81+, [GNU Tools for ARM Embedded Processor 4.8+](https://launchpad.net/gcc-arm-embedded)
2 changes: 2 additions & 0 deletions inc/libbase/cmsis/core_cm4.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#if defined ( __ICCARM__ )
#pragma system_include /* treat file as system include file for MISRA check */
#elif defined ( __GNUC__ )
#pragma GCC system_header
#endif

#ifndef __CORE_CM4_H_GENERIC
Expand Down
2 changes: 2 additions & 0 deletions inc/libbase/cmsis/core_cm4_simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#if defined ( __ICCARM__ )
#pragma system_include /* treat file as system include file for MISRA check */
#elif defined ( __GNUC__ )
#pragma GCC system_header
#endif

#ifndef __CORE_CM4_SIMD_H
Expand Down
14 changes: 14 additions & 0 deletions inc/libbase/cmsis/core_cmFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@
---------------------------------------------------------------------------*/


#if defined ( __ICCARM__ )
#pragma system_include /* treat file as system include file for MISRA check */
#elif defined ( __GNUC__ )
#pragma GCC system_header
#endif

#ifndef __CORE_CMFUNC_H
#define __CORE_CMFUNC_H

#ifdef __cplusplus
extern "C" {
#endif


/* ########################### Core Function Access ########################### */
/** \ingroup CMSIS_Core_FunctionInterface
Expand Down Expand Up @@ -634,4 +644,8 @@ __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fps

/*@} end of CMSIS_Core_RegAccFunctions */

#ifdef __cplusplus
}
#endif

#endif /* __CORE_CMFUNC_H */
16 changes: 15 additions & 1 deletion inc/libbase/cmsis/core_cmInstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@
---------------------------------------------------------------------------*/


#if defined ( __ICCARM__ )
#pragma system_include /* treat file as system include file for MISRA check */
#elif defined ( __GNUC__ )
#pragma GCC system_header
#endif

#ifndef __CORE_CMINSTR_H
#define __CORE_CMINSTR_H

#ifdef __cplusplus
extern "C" {
#endif


/* ########################## Core Instruction Access ######################### */
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
Expand Down Expand Up @@ -447,7 +457,7 @@ __attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value
*/
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
{
return (op1 >> op2) | (op1 << (32 - op2));
return (op1 >> op2) | (op1 << (32 - op2));
}


Expand Down Expand Up @@ -684,4 +694,8 @@ __attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value)

/*@}*/ /* end of group CMSIS_Core_InstructionInterface */

#ifdef __cplusplus
}
#endif

#endif /* __CORE_CMINSTR_H */
39 changes: 35 additions & 4 deletions inc/libbase/k60/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* adc.h
*
* Author: Ming Tsang
* Copyright (c) 2014 HKUST SmartCar Team
* Copyright (c) 2014-2015 HKUST SmartCar Team
* Refer to LICENSE for details
*/

#pragma once
Expand All @@ -14,6 +15,7 @@

#include "libbase/k60/misc_utils.h"
#include "libbase/k60/pin.h"
#include "libbase/k60/pinout_macros.h"

namespace libbase
{
Expand Down Expand Up @@ -46,6 +48,28 @@ class Adc
kAdc1Ad23, kAdc1Ad24, kAdc1Ad25, kAdc1Ad26, kAdc1Ad27,
kAdc1Ad28, kAdc1Ad29, kAdc1Ad30, kAdc1Ad31,

#if PINOUT_ADC_COUNT > 2
kAdc2DAd0 = 72, kAdc2DAd1, kAdc2DAd2, kAdc2DAd3,
kAdc2Ad4A, kAdc2Ad5A, kAdc2Ad6A, kAdc2Ad7A,
kAdc2Ad4B, kAdc2Ad5B, kAdc2Ad6B, kAdc2Ad7B,
kAdc2Ad8, kAdc2Ad9, kAdc2Ad10, kAdc2Ad11, kAdc2Ad12,
kAdc2Ad13, kAdc2Ad14, kAdc2Ad15, kAdc2Ad16, kAdc2Ad17,
kAdc2Ad18, kAdc2Ad19, kAdc2Ad20, kAdc2Ad21, kAdc2Ad22,
kAdc2Ad23, kAdc2Ad24, kAdc2Ad25, kAdc2Ad26, kAdc2Ad27,
kAdc2Ad28, kAdc2Ad29, kAdc2Ad30, kAdc2Ad31,
#endif

#if PINOUT_ADC_COUNT > 3
kAdc3DAd0 = 108, kAdc3DAd1, kAdc3DAd2, kAdc3DAd3,
kAdc3Ad4A, kAdc3Ad5A, kAdc3Ad6A, kAdc3Ad7A,
kAdc3Ad4B, kAdc3Ad5B, kAdc3Ad6B, kAdc3Ad7B,
kAdc3Ad8, kAdc3Ad9, kAdc3Ad10, kAdc3Ad11, kAdc3Ad12,
kAdc3Ad13, kAdc3Ad14, kAdc3Ad15, kAdc3Ad16, kAdc3Ad17,
kAdc3Ad18, kAdc3Ad19, kAdc3Ad20, kAdc3Ad21, kAdc3Ad22,
kAdc3Ad23, kAdc3Ad24, kAdc3Ad25, kAdc3Ad26, kAdc3Ad27,
kAdc3Ad28, kAdc3Ad29, kAdc3Ad30, kAdc3Ad31,
#endif

kDisable
};

Expand Down Expand Up @@ -114,12 +138,19 @@ class Adc
void StopConvert();

/**
* Return the result of a single conversion. If a conversion has not been
* started yet, it will be started automatically (through StartConvert()).
* Return the raw result of a single conversion. If a conversion has not
* been started yet, it will be started automatically (through StartConvert())
*
* @return The result
* @return
*/
uint16_t GetResult();
/**
* Return the divided result of a single conversion. If a conversion has not
* been started yet, it will be started automatically (through StartConvert())
*
* @return The result, [0.0, 3.3]
*/
float GetResultF();
bool PeekResult(uint16_t *out_val);

bool IsActive() const;
Expand Down
3 changes: 2 additions & 1 deletion inc/libbase/k60/adc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* adc_utils.h
*
* Author: Ming Tsang
* Copyright (c) 2014 HKUST SmartCar Team
* Copyright (c) 2014-2015 HKUST SmartCar Team
* Refer to LICENSE for details
*/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion inc/libbase/k60/clock_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* clock_utils.h
*
* Author: Ming Tsang
* Copyright (c) 2014 HKUST SmartCar Team
* Copyright (c) 2014-2015 HKUST SmartCar Team
* Refer to LICENSE for details
*/

#pragma once
Expand Down
4 changes: 4 additions & 0 deletions inc/libbase/k60/cmsis/mk60f15.h
Original file line number Diff line number Diff line change
Expand Up @@ -11138,6 +11138,10 @@ typedef struct {
*/ /* end of group Backward_Compatibility_Symbols */


#ifdef __cplusplus
}
#endif

#endif /* #if !defined(MK60F15_H_) */

/* MK60F15.h, eof. */
23 changes: 23 additions & 0 deletions inc/libbase/k60/cmsis/system.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* system.h
*
* Author: Ming Tsang
* Copyright (c) 2014-2015 HKUST SmartCar Team
* Refer to LICENSE for details
*/

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

/**
* Setup the microcontroller system. This function should be used only after
* reset
*/
void SystemInit(void);

#ifdef __cplusplus
}
#endif
32 changes: 0 additions & 32 deletions inc/libbase/k60/cmsis/system_mk60dz10.h

This file was deleted.

3 changes: 2 additions & 1 deletion inc/libbase/k60/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* crc.h
*
* Author: Ming Tsang
* Copyright (c) 2014 HKUST SmartCar Team
* Copyright (c) 2014-2015 HKUST SmartCar Team
* Refer to LICENSE for details
*/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion inc/libbase/k60/crc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* crc_utils.h
*
* Author: Ming Tsang
* Copyright (c) 2014 HKUST SmartCar Team
* Copyright (c) 2014-2015 HKUST SmartCar Team
* Refer to LICENSE for details
*/

#pragma once
Expand Down
Loading

0 comments on commit 39b0662

Please sign in to comment.