Cleaned up folders.
This commit is contained in:
0
example/.gitignore → .gitignore
vendored
0
example/.gitignore → .gitignore
vendored
61
README.md
61
README.md
@@ -1,65 +1,6 @@
|
|||||||
BFH stm32f4 discovery linuxsupport
|
Discoverpixy
|
||||||
============================
|
============================
|
||||||
|
|
||||||
#TODO
|
#TODO
|
||||||
Adjust this readme
|
Adjust this readme
|
||||||
|
|
||||||
|
|
||||||
## Synopsis
|
|
||||||
|
|
||||||
The following project consists of a minimal setup for the carme-m4 STM32F407 board. The makefile should be easily adaptable to your needs.
|
|
||||||
|
|
||||||
## Motivation
|
|
||||||
|
|
||||||
We'd like to enable linux enthusiastic students of the bern university of applied sciences to work with their beloved operating system without setting up a virtual machine just to run *atollic true studio*. ;)
|
|
||||||
|
|
||||||
## Installation and required packages
|
|
||||||
|
|
||||||
You'll need the following packages installed on your system:
|
|
||||||
|
|
||||||
arm-none-eabi-binutils
|
|
||||||
arm-none-eabi-gcc
|
|
||||||
arm-none-eabi-gdb
|
|
||||||
arm-none-eabi-newlib
|
|
||||||
stlink
|
|
||||||
make
|
|
||||||
|
|
||||||
The package names are taken from the arch linux community repository, hence they may differ on your linux distribution.
|
|
||||||
|
|
||||||
## Instructions
|
|
||||||
|
|
||||||
####first steps
|
|
||||||
|
|
||||||
- Clone the repository.
|
|
||||||
- Install the required software packages.
|
|
||||||
- Plug in your carme-m4.
|
|
||||||
- Don't forget to add yourself to the group 'dialout' by invoking "gpasswd -a ${USER} dialout"
|
|
||||||
|
|
||||||
#### using make
|
|
||||||
|
|
||||||
- Build software: make all
|
|
||||||
- Debug software: make debug
|
|
||||||
- flash software: make flash
|
|
||||||
- start/stop st-util deamon: make start/stop
|
|
||||||
|
|
||||||
|
|
||||||
#### eclipse support
|
|
||||||
|
|
||||||
If you want to use eclipse instead of pure makefiles you are free to do so and we are happy to support you with that:
|
|
||||||
|
|
||||||
- Checkout the readme in the eclipse directory for instructions on how to install and configure eclipse correctly.
|
|
||||||
- Import the example project into eclipse as "existing project" and have fun :)
|
|
||||||
|
|
||||||
|
|
||||||
## Contributors
|
|
||||||
|
|
||||||
- t-moe
|
|
||||||
- id101010
|
|
||||||
|
|
||||||
## Links
|
|
||||||
|
|
||||||
- https://carme.bfh.ch
|
|
||||||
|
|
||||||
## Additional Tags
|
|
||||||
|
|
||||||
stm32, stm32f407, bfh ti, berner fachhochschule für technik und informatik, carme-m4, atollic true studio, linux
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
Eclipse Support
|
|
||||||
============================
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Eclipse CDT integrates seamlessly with makefile projects. Furthermore you can flash your target and debug it using eclipse (via gdb).
|
|
||||||
|
|
||||||
## Eclipse Installation
|
|
||||||
|
|
||||||
- Install eclipse (normal package)
|
|
||||||
- Run the script install.sh. It will install CDT and the required plugins to get you started.
|
|
||||||
|
|
||||||
## How to use
|
|
||||||
- Copy the example project to your desired location and import it into eclipse as "existing project".
|
|
||||||
- Open the C/C++ Perspective
|
|
||||||
- You can compile the code normally by pressing the "build" button. Our makefile is used in the background.
|
|
||||||
- To download the code you have to press the "debug" button. Make sure the st-util deamon is running beforehand. (Start it with "make start")
|
|
||||||
- To debug the SFR's you can use the embsysregview plugin. [Tutorial](http://embsysregview.sourceforge.net/content/install3.html)
|
|
||||||
|
|
||||||
|
|
||||||
## Known Issues / Remarks
|
|
||||||
|
|
||||||
- If you rename the project in either the makefile and/or eclipse you need to ajust the pathes of the debug configuration.
|
|
||||||
- Eclipse shows an error when you try to debug and st-util is not started or has crashed. Use "make start/stop" to reconnect.
|
|
||||||
- The code analyzer in eclipse is separated form the compiler. You may see lines marked with an error although they would compile just fine. Check that the Include directories are correct in the project properties (search for "Paths and Symbols")
|
|
||||||
- Stepping **over** a for loop will cause the debugger to hang. This is a bug in st_link.
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo "installing cdt, make support, cross gcc support, gdb hardware debugging and memoryview enhancements"
|
|
||||||
|
|
||||||
eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/tools/cdt/releases/8.4 -installIU org.eclipse.cdt.feature.group,org.eclipse.cdt.gnu.build.feature.group,org.eclipse.cdt.build.crossgcc.feature.group,org.eclipse.cdt.debug.gdbjtag.feature.group,org.eclipse.cdt.debug.ui.memory.feature.group
|
|
||||||
|
|
||||||
|
|
||||||
echo "installing ebmsysregview (sfr register view)"
|
|
||||||
eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://embsysregview.sourceforge.net/update -installIU org.eclipse.cdt.embsysregview_feature.feature.group
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#include "stm32f4_discovery.h"
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
int state=0;
|
|
||||||
bool oldButtonState;
|
|
||||||
bool newButtonState;
|
|
||||||
|
|
||||||
STM_EVAL_LEDInit(LED3);
|
|
||||||
STM_EVAL_LEDInit(LED4);
|
|
||||||
STM_EVAL_LEDInit(LED5);
|
|
||||||
STM_EVAL_LEDInit(LED6);
|
|
||||||
STM_EVAL_PBInit(BUTTON_USER,BUTTON_MODE_GPIO);
|
|
||||||
|
|
||||||
STM_EVAL_LEDOff(LED3);
|
|
||||||
STM_EVAL_LEDOff(LED4);
|
|
||||||
STM_EVAL_LEDOff(LED5);
|
|
||||||
STM_EVAL_LEDOff(LED6);
|
|
||||||
|
|
||||||
while(1) {
|
|
||||||
|
|
||||||
newButtonState=STM_EVAL_PBGetState(BUTTON_USER);
|
|
||||||
if((newButtonState^oldButtonState) && newButtonState) {
|
|
||||||
state++;
|
|
||||||
state%=4;
|
|
||||||
}
|
|
||||||
oldButtonState=newButtonState;
|
|
||||||
|
|
||||||
switch(state) {
|
|
||||||
case 0:
|
|
||||||
STM_EVAL_LEDOff(LED6);
|
|
||||||
STM_EVAL_LEDOn(LED3);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
STM_EVAL_LEDOff(LED3);
|
|
||||||
STM_EVAL_LEDOn(LED4);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
STM_EVAL_LEDOff(LED4);
|
|
||||||
STM_EVAL_LEDOn(LED5);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
STM_EVAL_LEDOff(LED5);
|
|
||||||
STM_EVAL_LEDOn(LED6);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
70
src/main.c
Normal file
70
src/main.c
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
#include "stm32f4_discovery.h"
|
||||||
|
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int state=0;
|
||||||
|
const int APB1_CLK=42E6; //42mhz APB1 Takt
|
||||||
|
TIM_TimeBaseInitTypeDef tinit;
|
||||||
|
|
||||||
|
STM_EVAL_LEDInit(LED3);
|
||||||
|
STM_EVAL_LEDInit(LED4);
|
||||||
|
STM_EVAL_LEDInit(LED5);
|
||||||
|
STM_EVAL_LEDInit(LED6);
|
||||||
|
|
||||||
|
STM_EVAL_LEDOff(LED3);
|
||||||
|
STM_EVAL_LEDOff(LED4);
|
||||||
|
STM_EVAL_LEDOff(LED5);
|
||||||
|
STM_EVAL_LEDOff(LED6);
|
||||||
|
|
||||||
|
|
||||||
|
TIM_TimeBaseStructInit(&tinit);
|
||||||
|
|
||||||
|
RCC_APB1PeriphClockCmd(RCC_APB1ENR_TIM6EN,ENABLE);
|
||||||
|
//RCC->APB1ENR |= RCC_APB1ENR_TIM6EN;
|
||||||
|
|
||||||
|
tinit.TIM_Prescaler = APB1_CLK/1000 -1;
|
||||||
|
tinit.TIM_Period = 249;
|
||||||
|
TIM_TimeBaseInit(TIM6,&tinit);
|
||||||
|
TIM_Cmd(TIM6,ENABLE);
|
||||||
|
|
||||||
|
|
||||||
|
/*TIM6->PSC = APB1_CLK/1000 -1;
|
||||||
|
TIM6->DIER |=TIM_DIER_UIE;
|
||||||
|
TIM6->ARR = 249;
|
||||||
|
TIM6->CR1 |= TIM_CR1_ARPE | TIM_CR1_CEN;
|
||||||
|
TIM6->EGR = TIM_EGR_UG;
|
||||||
|
TIM6->SR &= ~TIM_SR_UIF;*/
|
||||||
|
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
|
||||||
|
//while((TIM6->SR&0x01)==0);
|
||||||
|
//TIM6->SR=0;
|
||||||
|
|
||||||
|
while(TIM_GetFlagStatus(TIM6,TIM_FLAG_Update)!=SET);
|
||||||
|
TIM_ClearFlag(TIM6,TIM_FLAG_Update);
|
||||||
|
|
||||||
|
state++;
|
||||||
|
state%=4;
|
||||||
|
|
||||||
|
switch(state) {
|
||||||
|
case 0:
|
||||||
|
STM_EVAL_LEDOff(LED5);
|
||||||
|
STM_EVAL_LEDOn(LED3);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
STM_EVAL_LEDOff(LED3);
|
||||||
|
STM_EVAL_LEDOn(LED4);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
STM_EVAL_LEDOff(LED4);
|
||||||
|
STM_EVAL_LEDOn(LED6);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
STM_EVAL_LEDOff(LED6);
|
||||||
|
STM_EVAL_LEDOn(LED5);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user