Skip to content

Commit

Permalink
[STM32H743] first successfull build!
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikaël BRIDAY committed Feb 21, 2024
1 parent aff5b21 commit b1beded
Show file tree
Hide file tree
Showing 41 changed files with 107,880 additions and 2,881 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
blink
build
CMakeLists.txt
*_exe
*.bin
*.map
*.py
19 changes: 19 additions & 0 deletions examples/cortex-m/armv7em/stm32h743/Nucleo-144/blink/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Blink example

This application is a simple periodic example wich toggles the green led (LD3 - pin 13) of the board.
Have a look into "blink.oil" file.

The system is based scheduled with a 1ms SysTick "SystemCounter".

The task "blink" toggles the GREEN led when executed.
This is not scheduled when the program starts.

This task is activated by the alarm "blink_blink".
This alarm starts 100ms (ALARMTIME) after "StartOS".
This alarm has a 100ms (CYCLETIME) period.

Configure the application with

`
goil --target=cortex-m/armv7em/stm32h743 --templates=../../../../../../goil/templates/ blink.oil
`
31 changes: 31 additions & 0 deletions examples/cortex-m/armv7em/stm32h743/Nucleo-144/blink/blink.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "pinAccess.h"
#include "tpl_os.h"

#define APP_Task_blink_START_SEC_CODE
#include "tpl_memmap.h"

#define LED_GREEN_PORT GPIOB
#define LED_GREEN_PIN 0
#define LED_BLUE_PORT GPIOB
#define LED_BLUE_PIN 7
#define LED_RED_PORT GPIOB
#define LED_RED_PIN 14

void initUserLed() {
pinMode(LED_GREEN_PORT,LED_GREEN_PIN,OUTPUT);
pinMode(LED_BLUE_PORT,LED_BLUE_PIN,OUTPUT);
pinMode(LED_RED_PORT,LED_RED_PIN,OUTPUT);
}

FUNC(int, OS_APPL_CODE) main(void) {
initUserLed();
StartOS(OSDEFAULTAPPMODE);
return 0;
}

TASK(blink) {
digitalToggle(LED_GREEN_PORT,LED_GREEN_PIN);
TerminateTask();
}
#define APP_Task_blink_STOP_SEC_CODE
#include "tpl_memmap.h"
65 changes: 65 additions & 0 deletions examples/cortex-m/armv7em/stm32h743/Nucleo-144/blink/blink.oil
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
OIL_VERSION = "2.5";

IMPLEMENTATION trampoline {

/* This fix the default STACKSIZE of tasks */
TASK {
UINT32 STACKSIZE = 300 ;
} ;

/* This fix the default STACKSIZE of ISRs */
ISR {
UINT32 STACKSIZE = 200 ;
} ;
};

CPU blink {
OS config {
STATUS = EXTENDED;
PAINT_STACK = TRUE;
PAINT_REGISTERS = TRUE;

BUILD = TRUE {
TRAMPOLINE_BASE_PATH = "../../../../../..";
APP_SRC = "blink.c";
APP_NAME = "blink_exe";
CFLAGS = "-O0";
LDFLAGS = "-Map=blink.map";
COMPILER = "arm-none-eabi-gcc";
ASSEMBLER = "arm-none-eabi-as";
LINKER = "arm-none-eabi-ld";
COPIER = "arm-none-eabi-objcopy";
//SYSTEM = PYTHON;
SYSTEM = CMAKE {VSCODE=TRUE;};
};
SYSTEM_CALL = TRUE;
MEMMAP = TRUE {
COMPILER = gcc;
LINKER = gnu_ld { SCRIPT = "script.ld"; };
ASSEMBLER = gnu_as;
MEMORY_PROTECTION = FALSE;
};
};

APPMODE std {};

TASK blink {
PRIORITY = 1;
AUTOSTART = FALSE;
ACTIVATION = 1;
SCHEDULE = FULL;
};

ALARM blink_blink {
COUNTER = SystemCounter;
ACTION = ACTIVATETASK {
TASK = blink;
};
AUTOSTART = TRUE {
APPMODE = std;
ALARMTIME = 100;
CYCLETIME = 100;
};
};
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"configurations": [
{
"name": "STM32 ARM",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
%let basePath := OS::BUILD_S::TRAMPOLINE_BASE_PATH
if [basePath charAtIndex: 0] != '/' then
let basePath := "${workspaceFolder}/"+basePath
end if%
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceFolder}",
"executable": "./build/% !OS::BUILD_S::APP_NAME %",
"name": "Debug on STM32 target",
"request": "launch", //"launch" => reload firmware, "attach" => just start debug session
"type": "cortex-debug",
"showDevDebugOutput": "none",
"servertype": "stutil",
"runToEntryPoint": "main",
"device": "STM32H743ZI",
"v1": false,
"svdFile": "% !basePath %/machines/cortex-m/armv7em/stm32h743/CMSIS/STM32H743.svd",
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cmake.configureSettings": {
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/% !PROJECT %/compiler.cmake"
},
"cmake.configureOnOpen": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
%
template if exists tpl_library_defines

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
%#template for external interrupts.
# This template is called from ../interrupt_table.goilTemplate
# the objective is to generate to code snippet to
# - check if the external interrupt is set
# - call the external interrupt handler
# - acknowledge the interrut

let pin := ""
foreach src in [obj::SOURCE_S map] do
if typeof src == @string then
let pin := src
end if
end foreach
let num := [pin subString: 2, 2]

if exists isISR2 then #called for ISR2
% if(EXTI->PR1 & EXTI_PR1_PIF%!num%) {
tpl_fast_central_interrupt_handler(%!obj::NAME%_id);
EXTI->PR1 = EXTI_PR1_PIF%!num%; /* ack */
}
%
elsif exists isISR1 then #called for ISR1
% if(EXTI->PR1 & EXTI_PR1_PIF%!num%) {
%!obj::NAME %_function();
EXTI->PR1 = EXTI_PR1_PIF%!num%; /* ack */
}
%
elsif exists isCounter then #called for Counter
% if(EXTI->PR1 & EXTI_PR1_PIF%!num%) {
tpl_tick_% !objCounter_KEY %();
EXTI->PR1 = EXTI_PR1_PIF%!num%; /* ack */
}
%
else #error here: "should not happen: either ISR1 or ISR2"
end if
Loading

0 comments on commit b1beded

Please sign in to comment.