This commit is contained in:
Romain Goyet
2015-05-03 23:19:14 +02:00
parent 7521af7457
commit 7f00bcccfa
4 changed files with 92 additions and 10 deletions

View File

@@ -10,7 +10,14 @@ extern const void * _bss_section_end_ram;
extern const void * _stack_start;
extern const void * _stack_end;
void _start(void);
void _ResetServiceRoutine(void);
void _NMIServiceRoutine(void);
void _HardFaultServiceRoutine(void);
void _MemManageServiceRoutine(void);
void _BusFaultServiceRoutine(void);
void _SVCallServiceRoutine(void);
void _PendSVServiceRoutine(void);
void _SystickServiceRoutine(void);
/* Interrupt Service Routines are void->void functions */
typedef void(*ISR)(void);
@@ -27,15 +34,24 @@ ISR InitialisationVector[INITIALISATION_VECTOR_SIZE]
__attribute__((section(".isr_vector_table")))
= {
(ISR)&_stack_start,
_start,
0,
0,
_ResetServiceRoutine,
_NMIServiceRoutine,
_HardFaultServiceRoutine,
_MemManageServiceRoutine,
_BusFaultServiceRoutine,
0, // UsageFault
0, // Reserved
_SVCallServiceRoutine,
0, // Debug Monitor
_PendSVServiceRoutine, // PendSV
_SystickServiceRoutine, // Systick
0
};
int main(int argc, char * argv[]);
void _start(void) {
void _ResetServiceRoutine(void) {
// This is where execution starts after reset.
// Many things are not initialized yet so the code here has to pay attention.
@@ -54,3 +70,23 @@ void _start(void) {
main(0, 0x0);
}
void _NMIServiceRoutine(void) {
while (1) {
}
}
void _HardFaultServiceRoutine(void) {
while (1) {
}
}
void _MemManageServiceRoutine(void) {
while (1) {
}
}
void _BusFaultServiceRoutine(void) {
while (1) {
}
}

View File

@@ -158,13 +158,15 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
//#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
#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
#define vPortSVCHandler _SVCallServiceRoutine
#define xPortPendSVHandler _PendSVServiceRoutine
#define xPortSysTickHandler _SystickServiceRoutine
#endif /* FREERTOS_CONFIG_H */

2
external/NEWLIB.txt vendored Normal file
View File

@@ -0,0 +1,2 @@
- Using memcpy and memset
- using <string.h>, <stdlib.h>, and <stdint.h>

42
src/freertos_blinky.c Normal file
View File

@@ -0,0 +1,42 @@
#include <registers.h>
#include <FreeRTOS.h>
#include <task.h>
#include <timers.h>
#include <semphr.h>
int main(int argc, char * argv[]) {
vTaskStartScheduler();
// We want to blink LEDs connected to GPIO pin G13 and G14
// (this is documented in our board's PDF)
//
// GPIO are grouped by letter, and GPIO "G" live on the "AHB1" bus
// (this is documented in the STM32F4 reference mnual, page 65)
// Step 1 : Enable clock in RCC_AHBxENR
RCC_AHB1ENR->GPIOGEN = 1;
// Step 2 : Configure the GPIO pin to "general purpose output
GPIO_MODER(GPIOG)->MODER13 = GPIO_MODE_OUTPUT;
GPIO_MODER(GPIOG)->MODER14 = GPIO_MODE_OUTPUT;
// Per doc, the output is push-pull by default (yay)
// And we should also set the output speed, but really
// we don't care (we're doing something super slow)
long delay = 50000;
while (1) {
GPIO_ODR(GPIOG)->ODR13 = 0;
GPIO_ODR(GPIOG)->ODR14 = 1;
// sleep(delay);
GPIO_ODR(GPIOG)->ODR13 = 1;
GPIO_ODR(GPIOG)->ODR14 = 0;
// sleep(delay);
}
}