Moved F373 SPI demo into SPI multi demo, removed old one.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14958 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-10-26 13:02:10 +00:00
parent ab9469553a
commit fd7994a06b
12 changed files with 422 additions and 503 deletions

View File

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.136751823">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.136751823" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.136751823" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.136751823." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1163202645" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1163202645.1373264752" name=""/>
<builder autoBuildTarget="all" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.2145413690" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.230924741" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1900998730" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.796416080" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.2024435531" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.2053848662" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1597562528" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1677206556" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="STM32F37x-SPI.null.1323437907" name="STM32F37x-SPI"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="0.136751823">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
</cproject>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>STM32F37x-SPI</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>board</name>
<type>2</type>
<locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
</link>
<link>
<name>os</name>
<type>2</type>
<locationURI>CHIBIOS/os</locationURI>
</link>
</linkedResources>
</projectDescription>

View File

@ -1,165 +0,0 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "ch.h"
#include "hal.h"
/*
* Maximum speed SPI configuration (18MHz, CPHA=0, CPOL=0, MSb first).
*/
static const SPIConfig hs_spicfg = {
.circular = false,
.slave = false,
.data_cb = NULL,
.error_cb = NULL,
.ssport = GPIOB,
.sspad = 10U,
.cr1 = 0U,
.cr2 = SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0
};
/*
* Low speed SPI configuration (140.625kHz, CPHA=0, CPOL=0, MSb first).
*/
static const SPIConfig ls_spicfg = {
.circular = false,
.slave = false,
.data_cb = NULL,
.error_cb = NULL,
.ssport = GPIOB,
.sspad = 10U,
.cr1 = SPI_CR1_BR_2 | SPI_CR1_BR_1,
.cr2 = SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0
};
/*
* SPI TX and RX buffers.
*/
static uint8_t txbuf[512];
static uint8_t rxbuf[512];
/*
* SPI bus contender 1.
*/
static THD_WORKING_AREA(spi_thread_1_wa, 256);
static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOC, GPIOC_LED2); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
spiSelect(&SPID2); /* Slave Select assertion. */
spiExchange(&SPID2, 512,
txbuf, rxbuf); /* Atomic transfer operations. */
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
}
/*
* SPI bus contender 2.
*/
static THD_WORKING_AREA(spi_thread_2_wa, 256);
static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOC, GPIOC_LED2); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
spiSelect(&SPID2); /* Slave Select assertion. */
spiExchange(&SPID2, 512,
txbuf, rxbuf); /* Atomic transfer operations. */
spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
}
/*
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
static THD_WORKING_AREA(blinker_wa, 128);
static THD_FUNCTION(blinker, arg) {
(void)arg;
chRegSetThreadName("blinker");
while (true) {
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
}
}
/*
* Application entry point.
*/
int main(void) {
unsigned i;
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* SPI2 I/O pins setup.
*/
palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5) |
PAL_STM32_OSPEED_HIGHEST); /* New MISO. */
palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(5) |
PAL_STM32_OSPEED_HIGHEST); /* New MOSI. */
/*
* Prepare transmit pattern.
*/
for (i = 0; i < sizeof(txbuf); i++)
txbuf[i] = (uint8_t)i;
/*
* Starting the transmitter and receiver threads.
*/
chThdCreateStatic(spi_thread_1_wa, sizeof(spi_thread_1_wa),
NORMALPRIO + 1, spi_thread_1, NULL);
chThdCreateStatic(spi_thread_2_wa, sizeof(spi_thread_2_wa),
NORMALPRIO + 1, spi_thread_2, NULL);
/*
* Starting the blinker thread.
*/
chThdCreateStatic(blinker_wa, sizeof(blinker_wa),
NORMALPRIO-1, blinker, NULL);
/*
* Normal main() thread activity, in this demo it does nothing.
*/
while (true) {
chThdSleepMilliseconds(500);
}
return 0;
}

View File

@ -1,30 +0,0 @@
*****************************************************************************
** ChibiOS/HAL - SPI driver demo for STM32F37x. **
*****************************************************************************
** TARGET **
The demo runs on an STMicroelectronics STM32373C-EVAL board.
** The Demo **
The application demonstrates the use of the STM32F37x SPI driver.
** Board Setup **
- Connect PB14 and PB15 together for SPI loop-back.
** Build Procedure **
The demo has been tested using the free Codesourcery GCC-based toolchain
and YAGARTO.
Just modify the TRGT line in the makefile in order to use different GCC ports.
** Notes **
Some files used by the demo are not part of ChibiOS/RT but are copyright of
ST Microelectronics and are licensed under a different license.
Also note that not all the files present in the ST library are distributed
with ChibiOS/RT, you can find the whole library on the ST web site:
http://www.st.com

View File

@ -341,12 +341,47 @@
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration> </cconfiguration>
<cconfiguration id="0.1093754934.1825368971.2147145117">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1093754934.1825368971.2147145117" moduleId="org.eclipse.cdt.core.settings" name="Build for STM32373C-Eval">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1093754934.1825368971.2147145117" name="Build for STM32373C-Eval" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.1093754934.1825368971.2147145117." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1794503203" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1794503203.870827732" name=""/>
<builder arguments="-f ./make/stm32f373vc_eval.make" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.1125298235" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="unlimited" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.2006747442" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.506480737" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1360224872" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1556221885" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1871607777" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.2098347012" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1209317593" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="STM32-SPI.null.932840044" name="STM32-SPI"/> <project id="STM32-SPI.null.932840044" name="STM32-SPI"/>
</storageModule> </storageModule>
<storageModule moduleId="refreshScope" versionNumber="2"> <storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Build for STM32F303-Discovery"/> <configuration configurationName="Build for STM32F303-Discovery"/>
<configuration configurationName="Build for STM32G474RE-Nucleo64"/>
<configuration configurationName="Build for STM32F103-Olimex"/> <configuration configurationName="Build for STM32F103-Olimex"/>
<configuration configurationName="Build for STM32H755-Nucleo144"/> <configuration configurationName="Build for STM32H755-Nucleo144"/>
<configuration configurationName="Build for STM32L151-Discovery"> <configuration configurationName="Build for STM32L151-Discovery">

View File

@ -101,14 +101,14 @@ void portab_setup(void) {
* SPI2 I/O pins setup. * SPI2 I/O pins setup.
*/ */
palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(0) | palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(0) |
PAL_STM32_OSPEED_HIGHEST); /* New SCK. */ PAL_STM32_OSPEED_HIGHEST); /* SPI2 SCK. */
palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(0) | palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(0) |
PAL_STM32_OSPEED_HIGHEST); /* New MISO. */ PAL_STM32_OSPEED_HIGHEST); /* SPI2 MISO. */
palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(0) | palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(0) |
PAL_STM32_OSPEED_HIGHEST); /* New MOSI. */ PAL_STM32_OSPEED_HIGHEST); /* SPI2 MOSI. */
palSetPad(GPIOB, 12); palSetPad(GPIOB, 12);
palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL | palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL |
PAL_STM32_OSPEED_HIGHEST); /* New CS. */ PAL_STM32_OSPEED_HIGHEST); /* SPI2 CS. */
} }
/** @} */ /** @} */

View File

@ -0,0 +1,113 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file portab.c
* @brief Application portability module code.
*
* @addtogroup application_portability
* @{
*/
#include "hal.h"
#include "portab.h"
/*===========================================================================*/
/* Module local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Module exported variables. */
/*===========================================================================*/
void spi_circular_cb(SPIDriver *spip);
void spi_error_cb(SPIDriver *spip);
/*
* Circular SPI configuration (18MHz, CPHA=0, CPOL=0, MSb first).
*/
const SPIConfig c_spicfg = {
.circular = true,
.slave = false,
.data_cb = spi_circular_cb,
.error_cb = spi_error_cb,
.ssport = GPIOB,
.sspad = 10U,
.cr1 = SPI_CR1_BR_0,
.cr2 = SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0
};
/*
* Maximum speed SPI configuration (18MHz, CPHA=0, CPOL=0, MSb first).
*/
const SPIConfig hs_spicfg = {
.circular = false,
.slave = false,
.data_cb = NULL,
.error_cb = spi_error_cb,
.ssport = GPIOB,
.sspad = 10U,
.cr1 = SPI_CR1_BR_0,
.cr2 = SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0
};
/*
* Low speed SPI configuration (562.5kHz, CPHA=0, CPOL=0, MSb first).
*/
const SPIConfig ls_spicfg = {
.circular = false,
.slave = false,
.data_cb = NULL,
.error_cb = spi_error_cb,
.ssport = GPIOB,
.sspad = 10U,
.cr1 = SPI_CR1_BR_2 | SPI_CR1_BR_1,
.cr2 = SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0
};
/*===========================================================================*/
/* Module local types. */
/*===========================================================================*/
/*===========================================================================*/
/* Module local variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Module local functions. */
/*===========================================================================*/
/*===========================================================================*/
/* Module exported functions. */
/*===========================================================================*/
void portab_setup(void) {
/*
* SPI2 I/O pins setup.
*/
palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) |
PAL_STM32_OSPEED_HIGHEST); /* SPI2 SCK. */
palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5) |
PAL_STM32_OSPEED_HIGHEST); /* SPI2 MISO. */
palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(5) |
PAL_STM32_OSPEED_HIGHEST); /* SPI2 MOSI. */
palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL |
PAL_STM32_OSPEED_HIGHEST); /* SPI2 CS. */
palSetPad(GPIOB, 10);
}
/** @} */

View File

@ -0,0 +1,80 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file portab.h
* @brief Application portability macros and structures.
*
* @addtogroup application_portability
* @{
*/
#ifndef PORTAB_H
#define PORTAB_H
/*===========================================================================*/
/* Module constants. */
/*===========================================================================*/
#define PORTAB_LINE_LED1 LINE_LED1
#define PORTAB_LINE_LED2 LINE_LED2
#define PORTAB_LED_OFF PAL_LOW
#define PORTAB_LED_ON PAL_HIGH
#define PORTAB_LINE_BUTTON LINE_WKUP_BUTTON
#define PORTAB_BUTTON_PRESSED PAL_HIGH
#define PORTAB_SPI1 SPID1
/*===========================================================================*/
/* Module pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Module data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Module macros. */
/*===========================================================================*/
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
extern const SPIConfig c_spicfg;
extern const SPIConfig hs_spicfg;
extern const SPIConfig ls_spicfg;
#ifdef __cplusplus
extern "C" {
#endif
void portab_setup(void);
#ifdef __cplusplus
}
#endif
/*===========================================================================*/
/* Module inline functions. */
/*===========================================================================*/
#endif /* PORTAB_H */
/** @} */

View File

@ -5,7 +5,7 @@
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
endif endif
# C specific options here (added to USE_OPT). # C specific options here (added to USE_OPT).
@ -18,7 +18,7 @@ ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti USE_CPPOPT = -fno-rtti
endif endif
# Enable this if you want the linker to remove unused code and data # Enable this if you want the linker to remove unused code and data.
ifeq ($(USE_LINK_GC),) ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes USE_LINK_GC = yes
endif endif
@ -28,16 +28,11 @@ ifeq ($(USE_LDOPT),)
USE_LDOPT = USE_LDOPT =
endif endif
# Enable this if you want link time optimizations (LTO) # Enable this if you want link time optimizations (LTO).
ifeq ($(USE_LTO),) ifeq ($(USE_LTO),)
USE_LTO = yes USE_LTO = yes
endif endif
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
endif
# Enable this if you want to see the full log while compiling. # Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),) ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no USE_VERBOSE_COMPILE = no
@ -74,19 +69,30 @@ ifeq ($(USE_FPU),)
USE_FPU = no USE_FPU = no
endif endif
# FPU-related options.
ifeq ($(USE_FPU_OPT),)
USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
endif
# #
# Architecture or project specific options # Architecture or project specific options
############################################################################## ##############################################################################
############################################################################## ##############################################################################
# Project, sources and paths # Project, target, sources and paths
# #
# Define project name here # Define project name here
PROJECT = ch PROJECT = ch
# Imported source files and paths # Target settings.
CHIBIOS = ../../../.. MCU = cortex-m4
# Imported source files and paths.
CHIBIOS := ../../../..
CONFDIR := ./cfg/stm32f373vc_eval
BUILDDIR := ./build/stm32f373vc_eval
DEPDIR := ./.dep/stm32f373vc_eval
# Licensing files. # Licensing files.
include $(CHIBIOS)/os/license/license.mk include $(CHIBIOS)/os/license/license.mk
@ -100,91 +106,44 @@ include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
# RTOS files (optional). # RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
# Auto-build files in ./source recursively.
include $(CHIBIOS)/tools/mk/autobuild.mk
# Other files (optional). # Other files (optional).
#include $(CHIBIOS)/os/test/test.mk #include $(CHIBIOS)/os/test/test.mk
#include $(CHIBIOS)/test/rt/rt_test.mk #include $(CHIBIOS)/test/rt/rt_test.mk
#include $(CHIBIOS)/test/oslib/oslib_test.mk #include $(CHIBIOS)/test/oslib/oslib_test.mk
# Define linker script file here # Define linker script file here.
LDSCRIPT= $(STARTUPLD)/STM32F373xC.ld LDSCRIPT= $(STARTUPLD)/STM32F373xC.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global # C sources that can be compiled in ARM or THUMB mode depending on the global
# setting. # setting.
CSRC = $(ALLCSRC) \ CSRC = $(ALLCSRC) \
$(TESTSRC) \ $(TESTSRC) \
$(CONFDIR)/portab.c \
main.c main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global # C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting. # setting.
CPPSRC = $(ALLCPPSRC) CPPSRC = $(ALLCPPSRC)
# C sources to be compiled in ARM mode regardless of the global setting. # List ASM source files here.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACSRC =
# C++ sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACPPSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCPPSRC =
# List ASM source files here
ASMSRC = $(ALLASMSRC) ASMSRC = $(ALLASMSRC)
# List ASM with preprocessor source files here.
ASMXSRC = $(ALLXASMSRC) ASMXSRC = $(ALLXASMSRC)
INCDIR = $(ALLINC) $(TESTINC) # Inclusion directories.
INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
# # Define C warning options here.
# Project, sources and paths
##############################################################################
##############################################################################
# Compiler settings
#
MCU = cortex-m4
#TRGT = arm-elf-
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
# ARM-specific options here
AOPT =
# THUMB-specific options here
TOPT = -mthumb -DTHUMB
# Define C warning options here
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
# Define C++ warning options here # Define C++ warning options here.
CPPWARN = -Wall -Wextra -Wundef CPPWARN = -Wall -Wextra -Wundef
# #
# Compiler settings # Project, target, sources and paths
############################################################################## ##############################################################################
############################################################################## ##############################################################################
@ -207,8 +166,25 @@ ULIBDIR =
ULIBS = ULIBS =
# #
# End of user defines # End of user section
############################################################################## ##############################################################################
##############################################################################
# Common rules
#
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
include $(RULESPATH)/arm-none-eabi.mk
include $(RULESPATH)/rules.mk include $(RULESPATH)/rules.mk
#
# Common rules
##############################################################################
##############################################################################
# Custom rules
#
#
# Custom rules
##############################################################################