Update example-fsm-55.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2017-11-21 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* example-fsm-55: Update using stack-def.h.
|
||||||
|
|
||||||
2017-11-20 NIIBE Yutaka <gniibe@fsij.org>
|
2017-11-20 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* example-led: Update using stack-def.h.
|
* example-led: Update using stack-def.h.
|
||||||
|
|||||||
@@ -163,17 +163,19 @@ button (void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define STACK_MAIN
|
||||||
|
#define STACK_PROCESS_1
|
||||||
|
#define STACK_PROCESS_2
|
||||||
|
#include "stack-def.h"
|
||||||
|
|
||||||
#define PRIO_LED 3
|
#define PRIO_LED 3
|
||||||
#define PRIO_BUTTON 2
|
#define PRIO_BUTTON 2
|
||||||
|
|
||||||
extern uint8_t __process1_stack_base__[], __process1_stack_size__[];
|
#define STACK_ADDR_LED ((uint32_t)process1_base)
|
||||||
extern uint8_t __process2_stack_base__[], __process2_stack_size__[];
|
#define STACK_SIZE_LED (sizeof process1_base)
|
||||||
|
|
||||||
#define STACK_ADDR_LED ((uint32_t)__process1_stack_base__)
|
#define STACK_ADDR_BUTTON ((uint32_t)process2_base)
|
||||||
#define STACK_SIZE_LED ((uint32_t)__process1_stack_size__)
|
#define STACK_SIZE_BUTTON (sizeof process2_base)
|
||||||
|
|
||||||
#define STACK_ADDR_BUTTON ((uint32_t)__process2_stack_base__)
|
|
||||||
#define STACK_SIZE_BUTTON ((uint32_t)__process2_stack_size__)
|
|
||||||
|
|
||||||
#define DATA55(x0,x1,x2,x3,x4) (x0<<20)|(x1<<15)|(x2<<10)|(x3<< 5)|(x4<< 0)
|
#define DATA55(x0,x1,x2,x3,x4) (x0<<20)|(x1<<15)|(x2<<10)|(x3<< 5)|(x4<< 0)
|
||||||
#define SIZE55(img) (sizeof (img) / sizeof (uint32_t))
|
#define SIZE55(img) (sizeof (img) / sizeof (uint32_t))
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ST32F0 memory setup.
|
* ST32F0 memory setup.
|
||||||
*/
|
*/
|
||||||
__main_stack_size__ = 0x0100; /* Idle+Exception handlers */
|
|
||||||
__process0_stack_size__ = 0x0100; /* Main program */
|
|
||||||
__process1_stack_size__ = 0x0100; /* first thread program */
|
|
||||||
__process2_stack_size__ = 0x0100; /* second thread program */
|
|
||||||
__process3_stack_size__ = 0x0100; /* third thread program */
|
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
flash : org = 0x08000000, len = 16k
|
flash : org = 0x08000000, len = 16k
|
||||||
@@ -61,34 +55,15 @@ SECTIONS
|
|||||||
_etext = .;
|
_etext = .;
|
||||||
_textdata = _etext;
|
_textdata = _etext;
|
||||||
|
|
||||||
.process_stack :
|
.stacks (NOLOAD) :
|
||||||
{
|
{
|
||||||
. = ALIGN(8);
|
. = ALIGN(8);
|
||||||
__process3_stack_base__ = .;
|
*(.main_stack)
|
||||||
. += __process3_stack_size__;
|
*(.process_stack.0)
|
||||||
|
*(.process_stack.1)
|
||||||
|
*(.process_stack.2)
|
||||||
|
*(.process_stack.3)
|
||||||
. = ALIGN(8);
|
. = ALIGN(8);
|
||||||
__process3_stack_end__ = .;
|
|
||||||
__process2_stack_base__ = .;
|
|
||||||
. += __process2_stack_size__;
|
|
||||||
. = ALIGN(8);
|
|
||||||
__process2_stack_end__ = .;
|
|
||||||
__process1_stack_base__ = .;
|
|
||||||
. += __process1_stack_size__;
|
|
||||||
. = ALIGN(8);
|
|
||||||
__process1_stack_end__ = .;
|
|
||||||
__process0_stack_base__ = .;
|
|
||||||
. += __process0_stack_size__;
|
|
||||||
. = ALIGN(8);
|
|
||||||
__process0_stack_end__ = .;
|
|
||||||
} > ram
|
|
||||||
|
|
||||||
.main_stack :
|
|
||||||
{
|
|
||||||
. = ALIGN(8);
|
|
||||||
__main_stack_base__ = .;
|
|
||||||
. += __main_stack_size__;
|
|
||||||
. = ALIGN(8);
|
|
||||||
__main_stack_end__ = .;
|
|
||||||
} > ram
|
} > ram
|
||||||
|
|
||||||
.data :
|
.data :
|
||||||
|
|||||||
@@ -166,14 +166,16 @@ button (void *arg)
|
|||||||
#define PRIO_LED 3
|
#define PRIO_LED 3
|
||||||
#define PRIO_BUTTON 2
|
#define PRIO_BUTTON 2
|
||||||
|
|
||||||
extern uint8_t __process1_stack_base__[], __process1_stack_size__[];
|
#define STACK_MAIN
|
||||||
extern uint8_t __process2_stack_base__[], __process2_stack_size__[];
|
#define STACK_PROCESS_1
|
||||||
|
#define STACK_PROCESS_2
|
||||||
|
#include "stack-def.h"
|
||||||
|
|
||||||
#define STACK_ADDR_LED ((uint32_t)__process1_stack_base__)
|
#define STACK_ADDR_LED ((uint32_t)process1_base)
|
||||||
#define STACK_SIZE_LED ((uint32_t)__process1_stack_size__)
|
#define STACK_SIZE_LED (sizeof process1_base)
|
||||||
|
|
||||||
#define STACK_ADDR_BUTTON ((uint32_t)__process2_stack_base__)
|
#define STACK_ADDR_BUTTON ((uint32_t)process2_base)
|
||||||
#define STACK_SIZE_BUTTON ((uint32_t)__process2_stack_size__)
|
#define STACK_SIZE_BUTTON (sizeof process2_base)
|
||||||
|
|
||||||
#define DATA55(x0,x1,x2,x3,x4) (x0<<20)|(x1<<15)|(x2<<10)|(x3<< 5)|(x4<< 0)
|
#define DATA55(x0,x1,x2,x3,x4) (x0<<20)|(x1<<15)|(x2<<10)|(x3<< 5)|(x4<< 0)
|
||||||
#define SIZE55(img) (sizeof (img) / sizeof (uint32_t))
|
#define SIZE55(img) (sizeof (img) / sizeof (uint32_t))
|
||||||
|
|||||||
@@ -86,12 +86,16 @@ led_enable_column (uint8_t col)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define STACK_MAIN
|
||||||
|
#define STACK_PROCESS_1
|
||||||
|
#define STACK_PROCESS_2
|
||||||
|
#define STACK_PROCESS_3
|
||||||
|
#include "stack-def.h"
|
||||||
|
|
||||||
#define PRIO_LED 3
|
#define PRIO_LED 3
|
||||||
|
|
||||||
extern uint8_t __process1_stack_base__[], __process1_stack_size__[];
|
#define STACK_ADDR_LED ((uint32_t)process1_base)
|
||||||
|
#define STACK_SIZE_LED (sizeof process1_base)
|
||||||
#define STACK_ADDR_LED ((uint32_t)__process1_stack_base__)
|
|
||||||
#define STACK_SIZE_LED ((uint32_t)__process1_stack_size__)
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
led (void *arg)
|
led (void *arg)
|
||||||
@@ -119,10 +123,9 @@ led (void *arg)
|
|||||||
|
|
||||||
|
|
||||||
#define PRIO_SPK 4
|
#define PRIO_SPK 4
|
||||||
extern uint8_t __process2_stack_base__[], __process2_stack_size__[];
|
|
||||||
|
|
||||||
#define STACK_ADDR_SPK ((uint32_t)__process2_stack_base__)
|
#define STACK_ADDR_SPK ((uint32_t)process2_base)
|
||||||
#define STACK_SIZE_SPK ((uint32_t)__process2_stack_size__)
|
#define STACK_SIZE_SPK (sizeof process2_base)
|
||||||
|
|
||||||
static chopstx_mutex_t spk_mtx;
|
static chopstx_mutex_t spk_mtx;
|
||||||
static chopstx_cond_t spk_cnd;
|
static chopstx_cond_t spk_cnd;
|
||||||
@@ -193,10 +196,9 @@ spk (void *arg)
|
|||||||
|
|
||||||
|
|
||||||
#define PRIO_MUSIC 2
|
#define PRIO_MUSIC 2
|
||||||
extern uint8_t __process3_stack_base__[], __process3_stack_size__[];
|
|
||||||
|
|
||||||
#define STACK_ADDR_MUSIC ((uint32_t)__process3_stack_base__)
|
#define STACK_ADDR_MUSIC ((uint32_t)process3_base)
|
||||||
#define STACK_SIZE_MUSIC ((uint32_t)__process3_stack_size__)
|
#define STACK_SIZE_MUSIC (sizeof process3_base)
|
||||||
|
|
||||||
#define C 0
|
#define C 0
|
||||||
#define D 1
|
#define D 1
|
||||||
|
|||||||
54
example-fsm-55/stack-def.h
Normal file
54
example-fsm-55/stack-def.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#define MAIN_SIZE 0x0080 /* Idle+Exception handlers */
|
||||||
|
#define SIZE_0 0x0100 /* Main program */
|
||||||
|
#define SIZE_1 0x0100 /* first thread program */
|
||||||
|
#define SIZE_2 0x0100 /* second thread program */
|
||||||
|
#define SIZE_3 0x0100 /* third thread program */
|
||||||
|
|
||||||
|
#if defined(STACK_MAIN)
|
||||||
|
/*
|
||||||
|
* The terminology of "main" is confusing in ARM architecture.
|
||||||
|
* Here, "main_base" is for exception handlers.
|
||||||
|
*/
|
||||||
|
/* Idle+Exception handlers */
|
||||||
|
char __main_stack_end__[0] __attribute__ ((section(".main_stack")));
|
||||||
|
char main_base[MAIN_SIZE] __attribute__ ((section(".main_stack")));
|
||||||
|
|
||||||
|
/* Main program */
|
||||||
|
char __process0_stack_end__[0] __attribute__ ((section(".process_stack.0")));
|
||||||
|
char process0_base[SIZE_0] __attribute__ ((section(".process_stack.0")));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* First thread program */
|
||||||
|
#if defined(STACK_PROCESS_1)
|
||||||
|
char process1_base[SIZE_1] __attribute__ ((section(".process_stack.1")));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Second thread program */
|
||||||
|
#if defined(STACK_PROCESS_2)
|
||||||
|
char process2_base[SIZE_2] __attribute__ ((section(".process_stack.2")));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Third thread program */
|
||||||
|
#if defined(STACK_PROCESS_3)
|
||||||
|
char process3_base[SIZE_3] __attribute__ ((section(".process_stack.3")));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Fourth thread program */
|
||||||
|
#if defined(STACK_PROCESS_4)
|
||||||
|
char process4_base[SIZE_4] __attribute__ ((section(".process_stack.4")));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Fifth thread program */
|
||||||
|
#if defined(STACK_PROCESS_5)
|
||||||
|
char process5_base[SIZE_5] __attribute__ ((section(".process_stack.5")));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Sixth thread program */
|
||||||
|
#if defined(STACK_PROCESS_6)
|
||||||
|
char process6_base[SIZE_6] __attribute__ ((section(".process_stack.6")));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Seventh thread program */
|
||||||
|
#if defined(STACK_PROCESS_7)
|
||||||
|
char process7_base[SIZE_7] __attribute__ ((section(".process_stack.7")));
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user