Skip to content

Commit b988410

Browse files
committed
Added process activation function
The process activation function is needed to enter processes (their structures) into the register, which in itself is a register-flag to indicate the readiness for execution of which of the processes
1 parent f9585c5 commit b988410

12 files changed

Lines changed: 59 additions & 11 deletions

File tree

.vscode/c_cpp_properties.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"${workspaceFolder}/examples/stm32f4x/platform/hal/Inc",
99
"${workspaceFolder}/examples/stm32f4x/platform/cmsis/CMSIS/Include",
1010
"${workspaceFolder}/examples/stm32f4x/platform/cmsis/CMSIS/Device/ST/STM32F4xx/Include",
11-
"${workspaceFolder}/scheduler/inc",
12-
"${workspaceFolder}/scheduler/src",
11+
"${workspaceFolder}/sch/inc",
12+
"${workspaceFolder}/sch/src",
1313
"${workspaceFolder}/**"
1414
],
1515
"defines": [

doc/stm32project_doc/linker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Basic definitions
File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Little Q&A for myself
2+
## For what do I write `linker.md` file?
3+
For another attempt to combine all of thoughts and information about coding
4+
scripts for GCC linker (ld)

examples/stm32f4x/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ CFLAGS += -Iconfig
1919
CFLAGS += -Iplatform/hal/Inc
2020
CFLAGS += -Iplatform/cmsis/CMSIS/Include
2121
CFLAGS += -Iplatform/cmsis/CMSIS/Device/ST/STM32F4xx/Include
22-
CFLAGS += -I../../scheduler/inc
23-
CFLAGS += -I../../scheduler/src
22+
CFLAGS += -I../../sch/inc
23+
CFLAGS += -I../../sch/src
2424
CFLAGS += $(DEFS)
2525

2626
ASFLAGS = $(MCU) $(OPT)
@@ -47,7 +47,7 @@ app/src/stm32f4xx_hal_msp.c \
4747
app/src/stm32f4xx_it.c \
4848
app/src/syscalls.c \
4949
app/src/sysmem.c \
50-
../../scheduler/src/sch.c
50+
../../sch/src/sch.c
5151

5252
all: $(TARGET).elf
5353

examples/stm32f4x/app/src/main.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,46 @@ void MX_USART2_UART_Init(void);
1212
void sch_task_dispatch(sch_task_t* task);
1313
void sch_task_init(sch_task_t* task);
1414

15+
void echo_task_dispatch(sch_task_t* task);
16+
void echo_task_init(sch_task_t* task);
17+
18+
void echo_task_dispatch(sch_task_t* task) {
19+
char buf[40] = {0};
20+
snprintf(buf, sizeof(buf), "system: %ld,\r\npreempt:%ld\r\n", sch_system_tasks_ready_set, sch_preempt_tasks_ready_set);
21+
HAL_UART_Transmit(&huart2, (uint8_t*)buf, strlen(buf), HAL_MAX_DELAY);
22+
}
23+
24+
void echo_task_init(sch_task_t* task) {
25+
26+
}
27+
1528
int main(void)
1629
{
1730
HAL_Init();
1831
SystemClock_Config();
1932
MX_GPIO_Init();
2033
MX_USART2_UART_Init();
2134

22-
sch_task_t sch_task;
23-
//const sch_task_t* ptr = &sch_task;
35+
/*sch_task_t sch_task;
2436
sch_task_create(&sch_task, 10, 10, sch_task_dispatch, sch_task_init);
25-
sch_task_run(&sch_task, NULL);
37+
sch_task_run(&sch_task, NULL);*/
38+
39+
sch_task_t first_task;
40+
sch_task_create(&first_task, -3, 0, sch_task_dispatch, sch_task_init);
41+
sch_task_activate(&first_task);
42+
43+
sch_task_t second_task;
44+
sch_task_create(&second_task, 3, 0, sch_task_dispatch, sch_task_init);
45+
sch_task_activate(&second_task);
46+
47+
sch_task_t echo_data;
48+
sch_task_create(&echo_data, 2, 3, echo_task_dispatch, echo_task_init);
49+
sch_task_activate(&echo_data);
50+
sch_task_run(&echo_data, NULL);
2651

2752
while (1)
2853
{
29-
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
30-
HAL_Delay(1000);
54+
3155
}
3256
}
3357

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919

2020
typedef struct sch_task_t sch_task_t;
2121

22+
extern int32_t sch_system_tasks_ready_set;
23+
extern int32_t sch_preempt_tasks_ready_set;
24+
2225
/*--Definition of typedefs----------------------------------------------------*/
2326

24-
typedef uint8_t sch_task_priority;
27+
typedef int8_t sch_task_priority;
2528
typedef uint8_t sch_irq;
2629

2730
typedef void (*sch_task_dispatch_fn)(sch_task_t* task);

sch/port/esp32_wroom_32u/sch_assertion.c

Whitespace-only changes.

0 commit comments

Comments
 (0)