Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eco32-uCOS-III
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Martin Hofmann
eco32-uCOS-III
Commits
e0ed3c6b
Commit
e0ed3c6b
authored
Mar 03, 2019
by
Martin Hofmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rebase of recent changes
parent
5fc83df3
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
2092 additions
and
115 deletions
+2092
-115
Makefile
Makefile
+78
-12
Micrium/Software/Boards/THM/Generic/BSP/bsp.c
Micrium/Software/Boards/THM/Generic/BSP/bsp.c
+65
-0
Micrium/Software/Boards/THM/Generic/BSP/bsp.h
Micrium/Software/Boards/THM/Generic/BSP/bsp.h
+48
-0
Micrium/Software/Boards/THM/Generic/BSP/bsp_timer.c
Micrium/Software/Boards/THM/Generic/BSP/bsp_timer.c
+225
-0
Micrium/Software/Boards/THM/Generic/BSP/bsp_timer.h
Micrium/Software/Boards/THM/Generic/BSP/bsp_timer.h
+71
-0
Micrium/Software/Boards/THM/Generic/BSP/bsp_uart.h
Micrium/Software/Boards/THM/Generic/BSP/bsp_uart.h
+68
-0
Micrium/Software/Boards/THM/Generic/LCC/entry.s
Micrium/Software/Boards/THM/Generic/LCC/entry.s
+261
-0
Micrium/Software/uC-CPU/ECO32/LCC/cpu.h
Micrium/Software/uC-CPU/ECO32/LCC/cpu.h
+18
-70
Micrium/Software/uC-CPU/ECO32/LCC/cpu_a.s
Micrium/Software/uC-CPU/ECO32/LCC/cpu_a.s
+84
-33
Micrium/Software/uCOS-III/Ports/ECO32/LCC/os_cpu.h
Micrium/Software/uCOS-III/Ports/ECO32/LCC/os_cpu.h
+119
-0
Micrium/Software/uCOS-III/Ports/ECO32/LCC/os_cpu_a.s
Micrium/Software/uCOS-III/Ports/ECO32/LCC/os_cpu_a.s
+300
-0
Micrium/Software/uCOS-III/Ports/ECO32/os_cpu_c.c
Micrium/Software/uCOS-III/Ports/ECO32/os_cpu_c.c
+296
-0
Template/bsp_cfg.h
Template/bsp_cfg.h
+31
-0
Template/cpu_cfg.h
Template/cpu_cfg.h
+109
-0
Template/os_cfg.h
Template/os_cfg.h
+94
-0
Template/os_cfg_app.h
Template/os_cfg_app.h
+57
-0
app/app.c
app/app.c
+117
-0
app/app_cfg.h
app/app_cfg.h
+23
-0
app/standalone.lnk
app/standalone.lnk
+28
-0
No files found.
Makefile
View file @
e0ed3c6b
#
# Makefile for Micrim u
c
OS-III for eco32
# Makefile for Micrim u
C
OS-III for eco32
#
LCC
=
/home/wiggum/git/eco32/build/bin/lcc
BUILD
=
/home/wiggum/git/eco32/build/bin/
C_SRC
=
$(
shell
find ./
-type
f
-name
*
.c
)
S_SRC
=
$(
shell
find ./
-type
f
-name
*
.s
)
H_SRC
=
$(
shell
find ./
-type
f
-name
*
.h
)
LCC
=
$(BUILD)
/lcc
LD
=
$(BUILD)
/ld
LOAD
=
$(BUILD)
/load
OBJS
=
$(
addsuffix
.o,
$(
basename
$(C_SRC)
))
$(
addsuffix
.o,
$(
basename
$(S_SRC)
))
SIM
=
$(BUILD)
/sim
UCOS_SRCS
=
Micrium/Software/uC-CPU/cpu_core.c
\
Micrium/Software/uCOS-III/Source/os_q.c
\
Micrium/Software/uCOS-III/Source/os_stat.c
\
Micrium/Software/uCOS-III/Source/os_mutex.c
\
Micrium/Software/uCOS-III/Source/os_prio.c
\
Micrium/Software/uCOS-III/Source/os_sem.c
\
Micrium/Software/uCOS-III/Source/os_var.c
\
Micrium/Software/uCOS-III/Source/os_core.c
\
Micrium/Software/uCOS-III/Source/os_pend_multi.c
\
Micrium/Software/uCOS-III/Source/os_dbg.c
\
Micrium/Software/uCOS-III/Source/os_tick.c
\
Micrium/Software/uCOS-III/Source/os_mem.c
\
Micrium/Software/uCOS-III/Source/os_tmr.c
\
Micrium/Software/uCOS-III/Source/os_flag.c
\
Micrium/Software/uCOS-III/Source/os_msg.c
\
Micrium/Software/uCOS-III/Source/os_task.c
\
Micrium/Software/uCOS-III/Source/os_time.c
\
Micrium/Software/uCOS-III/Source/os_int.c
\
Micrium/Software/uCOS-III/Source/os_cfg_app.c
\
Micrium/Software/uC-LIB/lib_mem.c
\
Micrium/Software/uC-LIB/lib_math.c
\
Micrium/Software/uC-LIB/lib_ascii.c
\
Micrium/Software/uC-LIB/lib_str.c
ENTR_SRCS
=
Micrium/Software/Boards/THM/Generic/LCC/entry.s
BSP_SRCS
=
Micrium/Software/Boards/THM/Generic/BSP/bsp.c
\
Micrium/Software/Boards/THM/Generic/BSP/bsp_timer.c
PORT_SRCS
=
Micrium/Software/uC-CPU/ECO32/LCC/cpu_a.s
\
Micrium/Software/uCOS-III/Ports/ECO32/os_cpu_c.c
\
Micrium/Software/uCOS-III/Ports/ECO32/LCC/os_cpu_a.s
APP_SRCS
=
app/app.c
OBJS
=
$(
addsuffix
.o,
$(
basename
$(ENTR_SRCS)
))
\
$(
addsuffix
.o,
$(
basename
$(BSP_SRCS)
))
\
$(
addsuffix
.o,
$(
basename
$(PORT_SRCS)
))
\
$(
addsuffix
.o,
$(
basename
$(UCOS_SRCS)
))
\
$(
addsuffix
.o,
$(
basename
$(APP_SRCS)
))
INC_DIRS
=
Micrium/Software/uC-CPU
\
Micrium/Software/uC-CPU/ECO32/LCC
\
Micrium/Software/uCOS-III/Source
\
Micrium/Software/uCOS-III/Ports/ECO32/LCC
\
Micrium/Software/uC-LIB
\
Micrium/Software/Boards/THM/Generic/BSP
\
Template
\
app
INCS
=
$(
addprefix
-I
,
$(INC_DIRS)
)
EXE
=
uCOSApp
BIN
=
uCOSApp.bin
MAP
=
uCOSApp.map
EXE
=
kernel
BIN
=
kernel.bin
MAP
=
kernel.map
all
:
$(BIN)
run
:
$(BIN)
$(SIM)
-l
$(BIN)
-i
-a
0x00000000
-s
1
-t
0
$(BIN)
:
$(EXE)
@
echo
" LOAD
$@
"
@
$(LOAD)
-p
$(EXE)
$(BIN)
$(EXE)
:
$(OBJS) $(H_SRC)
$(EXE)
:
$(OBJS)
@
echo
" LD
$@
"
@
$(LD)
$(OBJS)
-s
app/standalone.lnk
-m
$(MAP)
-o
$(EXE)
%.o
:
%.c
$(LCC)
-A
-Wo-nostdinc
-Wo-nostdlib
-c
-o
$@
$^
@
echo
" CC
$@
"
@
$(LCC)
-Wo-nostdinc
-Wo-nostdlib
$(INCS)
-c
-o
$@
$^
%.o
:
%.s
@
echo
" AS
$@
"
@
$(LCC)
-Wo-nostdinc
-Wo-nostdlib
-c
-o
$@
$^
clean
:
rm
-f
$(OBJS)
$(EXE)
$(BIN)
$(MAP)
\ No newline at end of file
@
echo
"cleaning up.."
@
rm
-f
$(OBJS)
$(EXE)
$(BIN)
$(MAP)
Micrium/Software/Boards/THM/Generic/BSP/bsp.c
0 → 100644
View file @
e0ed3c6b
/*
*********************************************************************************************************
*
* GENERIC BSP FILE
*
* ECO32
* GENERIC C COMPILER
*
* Filename : bsp.c
* Version : V1.00.0
* Programmer(s) : MH
*
*********************************************************************************************************
*/
#define BSP_MODULE
#include <bsp.h>
#include <bsp_timer.h>
#include <cpu.h>
/*
*********************************************************************************************************
* BSP_Init()
*
* Description : Initialize the Board Support Package
*
* Return(s) : none
*********************************************************************************************************
*/
void
BSP_Init
(
void
)
{
CPU_SR_ALLOC
();
CPU_INT_DIS
();
BSP_SysTickInit
();
CPU_INT_EN
();
}
/*
*********************************************************************************************************
* RESET()
*
* Description : RESET the application
*
* Note(s) : (1) Can be used as a hardfault recover function that will reboot the application
*
* Return(s) : none
*********************************************************************************************************
*/
void
reset
(
void
);
/* in entry.s */
void
RESET
(
void
)
{
CPU_SR_ALLOC
();
CPU_INT_DIS
();
reset
();
}
Micrium/Software/Boards/THM/Generic/BSP/bsp.h
0 → 100644
View file @
e0ed3c6b
/*
*********************************************************************************************************
*
* GENERIC BSP FILE
*
* ECO32
* GENERIC C COMPILER
*
* Filename : bsp.h
* Version : V1.00.0
* Programmer(s) : MH
*
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MODULE
*
* Note(s) : (1) This CPU header file is protected from multiple pre-processor inclusion through use of
* the CPU module present pre-processor macro definition.
*********************************************************************************************************
*/
#ifndef BSP_PRESENT
/* See Note #1. */
#define BSP_PRESENT
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
void
RESET
(
void
);
void
BSP_Init
(
void
);
/*
*********************************************************************************************************
* MODULE END
*
* Note(s) : (1) See 'bsp_def.h MODULE'.
*********************************************************************************************************
*/
#endif
/* End of BSP module include. */
Micrium/Software/Boards/THM/Generic/BSP/bsp_timer.c
0 → 100644
View file @
e0ed3c6b
/*
*********************************************************************************************************
*
* GENERIC TIMER BSP FILE
*
* ECO32
* GENERIC C COMPILER
*
* Filename : bsp_timer.c
* Version : V1.00.0
* Programmer(s) : MH
*
*********************************************************************************************************
*/
#define BSP_TIMER_MODULE
#include <bsp_timer.h>
#include <cpu_core.h>
#include <os_cfg_app.h>
/*
*********************************************************************************************************
* BSP_SysTickInit()
*
* Description : Initialize the Timer that drives the systick
*
* Return(s) : none.
*
* Note(s) : (1) Timer 1 is used to drive the systick
*
* Return(s) : none
*********************************************************************************************************
*/
void
BSP_SysTickInit
(
void
)
{
TIMER1_CTL
=
TIMER_IE
;
TIMER1_DIV
=
TIMERHZ
/
OS_CFG_TICK_RATE_HZ
;
CPU_IntSrc_En
(
TIMER1_INTNR
);
}
/*
*********************************************************************************************************
* SYS TICK HANDLER
*
* Description : Handle the system tick (SysTick) interrupt, which is used to generate the uC/OS-III tick
* interrupt.
*
* Note(s) : (1) This function must be placed in the isrtable for the timer that is used to generate the
* tick interrupt
*
* (2) Time tick handling is not implemented in the uCOS port files since uCOS does not provide
* a hook to implement a timer initialization for the sys tick timer.
*
* Return(s) : none
*********************************************************************************************************
*/
void
BSP_CPU_SysTickHandler
(
void
)
{
volatile
CPU_INT32U
read
=
0
;
read
=
TIMER1_CTL
;
OSTimeTick
();
OSIntExit
();
}
/*
*********************************************************************************************************
* CPU_TS_TmrInit()
*
* Description : Initialize & start CPU timestamp timer.
*
* Argument(s) : none.
*
* Return(s) : none.
*
* Caller(s) : CPU_TS_Init().
*
* This function is an INTERNAL CPU module function & MUST be implemented by application/
* BSP function(s) [see Note #1] but MUST NOT be called by application function(s).
*
* Note(s) : (1) CPU_TS_TmrInit() is an application/BSP function that MUST be defined by the developer
* if either of the following CPU features is enabled :
*
* (a) CPU timestamps
* (b) CPU interrupts disabled time measurements
*
* See 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #1'
* & 'cpu_cfg.h CPU INTERRUPTS DISABLED TIME MEASUREMENT CONFIGURATION Note #1a'.
*
* (2) (a) Timer count values MUST be returned via word-size-configurable 'CPU_TS_TMR'
* data type.
*
* (1) If timer has more bits, truncate timer values' higher-order bits greater
* than the configured 'CPU_TS_TMR' timestamp timer data type word size.
*
* (2) Since the timer MUST NOT have less bits than the configured 'CPU_TS_TMR'
* timestamp timer data type word size; 'CPU_CFG_TS_TMR_SIZE' MUST be
* configured so that ALL bits in 'CPU_TS_TMR' data type are significant.
*
* In other words, if timer size is not a binary-multiple of 8-bit octets
* (e.g. 20-bits or even 24-bits), then the next lower, binary-multiple
* octet word size SHOULD be configured (e.g. to 16-bits). However, the
* minimum supported word size for CPU timestamp timers is 8-bits.
*
* See also 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #2'
* & 'cpu_core.h CPU TIMESTAMP DATA TYPES Note #1'.
*
* (b) Timer SHOULD be an 'up' counter whose values increase with each time count.
*
* (c) When applicable, timer period SHOULD be less than the typical measured time
* but MUST be less than the maximum measured time; otherwise, timer resolution
* inadequate to measure desired times.
*
* See also 'CPU_TS_TmrRd() Note #2'.
*
* (3) Timer 0 is used for timestamps.
*********************************************************************************************************
*/
#if (CPU_CFG_TS_TMR_EN == DEF_ENABLED)
void
CPU_TS_TmrInit
(
void
)
{
TIMER0_CTL
=
0
;
TIMER0_DIV
=
0xFFFFFFFF
;
}
#endif
/*
*********************************************************************************************************
* CPU_TS_TmrRd()
*
* Description : Get current CPU timestamp timer count value.
*
* Argument(s) : none.
*
* Return(s) : Timestamp timer count (see Notes #2a & #2b).
*
* Caller(s) : CPU_TS_Init(),
* CPU_TS_Get32(),
* CPU_TS_Get64(),
* CPU_IntDisMeasStart(),
* CPU_IntDisMeasStop().
*
* This function is an INTERNAL CPU module function & MUST be implemented by application/
* BSP function(s) [see Note #1] but SHOULD NOT be called by application function(s).
*
* Note(s) : (1) CPU_TS_TmrRd() is an application/BSP function that MUST be defined by the developer
* if either of the following CPU features is enabled :
*
* (a) CPU timestamps
* (b) CPU interrupts disabled time measurements
*
* See 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #1'
* & 'cpu_cfg.h CPU INTERRUPTS DISABLED TIME MEASUREMENT CONFIGURATION Note #1a'.
*
* (2) (a) Timer count values MUST be returned via word-size-configurable 'CPU_TS_TMR'
* data type.
*
* (1) If timer has more bits, truncate timer values' higher-order bits greater
* than the configured 'CPU_TS_TMR' timestamp timer data type word size.
*
* (2) Since the timer MUST NOT have less bits than the configured 'CPU_TS_TMR'
* timestamp timer data type word size; 'CPU_CFG_TS_TMR_SIZE' MUST be
* configured so that ALL bits in 'CPU_TS_TMR' data type are significant.
*
* In other words, if timer size is not a binary-multiple of 8-bit octets
* (e.g. 20-bits or even 24-bits), then the next lower, binary-multiple
* octet word size SHOULD be configured (e.g. to 16-bits). However, the
* minimum supported word size for CPU timestamp timers is 8-bits.
*
* See also 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #2'
* & 'cpu_core.h CPU TIMESTAMP DATA TYPES Note #1'.
*
* (b) Timer SHOULD be an 'up' counter whose values increase with each time count.
*
* (1) If timer is a 'down' counter whose values decrease with each time count,
* then the returned timer value MUST be ones-complemented.
*
* (c) (1) When applicable, the amount of time measured by CPU timestamps is
* calculated by either of the following equations :
*
* (A) Time measured = Number timer counts * Timer period
*
* where
*
* Number timer counts Number of timer counts measured
* Timer period Timer's period in some units of
* (fractional) seconds
* Time measured Amount of time measured, in same
* units of (fractional) seconds
* as the Timer period
*
* Number timer counts
* (B) Time measured = ---------------------
* Timer frequency
*
* where
*
* Number timer counts Number of timer counts measured
* Timer frequency Timer's frequency in some units
* of counts per second
* Time measured Amount of time measured, in seconds
*
* (2) Timer period SHOULD be less than the typical measured time but MUST be less
* than the maximum measured time; otherwise, timer resolution inadequate to
* measure desired times.
*
* (3) Timer 0 is used for timestamps
*********************************************************************************************************
*/
#if (CPU_CFG_TS_TMR_EN == DEF_ENABLED)
CPU_TS_TMR
CPU_TS_TmrRd
(
void
)
{
return
~
(
CPU_TS_TMR
)
TIMER0_CNT
;
}
#endif
Micrium/Software/Boards/THM/Generic/BSP/bsp_timer.h
0 → 100644
View file @
e0ed3c6b
/*
*********************************************************************************************************
*
* GENERIC TIMER BSP FILE
*
* ECO32
* GENERIC C COMPILER
*
* Filename : bsp_timer.h
* Version : V1.00.0
* Programmer(s) : MH
*
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MODULE
*
* Note(s) : (1) This CPU header file is protected from multiple pre-processor inclusion through use of
* the CPU module present pre-processor macro definition.
*********************************************************************************************************
*/
#ifndef BSP_TIMER_PRESENT
/* See Note #1. */
#define BSP_TIMER_PRESENT
/*
*********************************************************************************************************
* IOMEM DEFINES
*********************************************************************************************************
*/
#define TIMER0_BASE 0xF0000000
#define TIMER0_CTL (*(CPU_INT32U*)(TIMER0_BASE + 0))
#define TIMER0_DIV (*(CPU_INT32U*)(TIMER0_BASE + 4))
#define TIMER0_CNT (*(CPU_INT32U*)(TIMER0_BASE + 8))
#define TIMER0_INTNR 14
#define TIMER1_BASE 0xF0001000
#define TIMER1_CTL (*(CPU_INT32U*)(TIMER1_BASE + 0))
#define TIMER1_DIV (*(CPU_INT32U*)(TIMER1_BASE + 4))
#define TIMER1_CNT (*(CPU_INT32U*)(TIMER1_BASE + 8))
#define TIMER1_INTNR 15
#define TIMERHZ 50000000
#define TIMER_IE 0x2
#define TIMER_WR 0x1
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
void
BSP_SysTickInit
(
void
);
void
BSP_CPU_SysTickHandler
(
void
);
/*
*********************************************************************************************************
* MODULE END
*
* Note(s) : (1) See 'bsp_time.h MODULE'.
*********************************************************************************************************
*/
#endif
Micrium/Software/Boards/THM/Generic/BSP/bsp_uart.h
0 → 100644
View file @
e0ed3c6b
/*
*********************************************************************************************************
*
* GENERIC UART BSP FILE
*
* ECO32
* GENERIC C COMPILER
*
* Filename : bsp_uart.h
* Version : V1.00.0
* Programmer(s) : MH
*
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MODULE
*
* Note(s) : (1) This UART header file is protected from multiple pre-processor inclusion through use of
* the UART module present pre-processor macro definition.
*********************************************************************************************************
*/
#ifndef BSP_UART_PRESENT
/* See Note #1. */
#define BSP_UART_PRESENT
#include <os.h>
/*
*********************************************************************************************************
* IOMEM DEFINES
*********************************************************************************************************
*/
#define UART0_BASE 0xF0300000
#define UART0_CTL_IN (*(CPU_INT32U*)(UART0_BASE + 0))
#define UART0_DTA_IN (*(CPU_INT32U*)(UART0_BASE + 4))
#define UART0_INTNR_IN 1
#define UART0_CTL_OUT (*(CPU_INT32U*)(UART0_BASE + 8))
#define UART0_DTA_OUT (*(CPU_INT32U*)(UART0_BASE + 12))
#define UART0_INTNR_OUT 0
#define UART1_BASE 0xF0301000
#define UART1_CTL_IN (*(CPU_INT32U*)(UART1_BASE + 0))
#define UART1_DTA_IN (*(CPU_INT32U*)(UART1_BASE + 4))
#define UART1_INTNR_IN 3
#define UART1_CTL_OUT (*(CPU_INT32U*)(UART1_BASE + 8))
#define UART1_DTA_OUT (*(CPU_INT32U*)(UART1_BASE + 12))
#define UART1_INTNR_OUT 2
#define UART_IE 0x2
#define UART_RDY 0x1
/*
*********************************************************************************************************
* MODULE END
*
* Note(s) : (1) See 'bsp_uart.h MODULE'.
*********************************************************************************************************
*/
#endif
Micrium/Software/Boards/THM/Generic/LCC/entry.s
0 → 100644
View file @
e0ed3c6b
;********************************************************************************************************
;
; ECO32 SIM BSP FILE
;
; ECO32
; LCC ANSI-C COMPILER
;
; Filename : entry.s
; Version : V1.00.0
; Programmer(s) : MH
;********************************************************************************************************
;********************************************************************************************************
; EXTERNAL FUNCTIONS
;********************************************************************************************************
.
import
_bbss
.
import
_ebss
.
import
_initstacktop
.
import
main
.
import
OSCfg_ISRStkBasePtr
.
import
OSCfg_ISRStkSizeRAM
.
import
OSTCBCurPtr
.
import
BSP_CPU_SysTickHandler
.
import
BSP_Uart0_RcvHandler
.
import
BSP_Uart1_RcvHandler
.
import
OSIntEnter
.
import
OSIntExit
.
import
psw
.
import
isrtbl
;********************************************************************************************************
; EXPORTED FUNCTIONS
;********************************************************************************************************
.
export
reset
;********************************************************************************************************
; CODE GENERATION DIRECTIVES
;********************************************************************************************************
.
code
.
align
4
;********************************************************************************************************
; EXCEPTION VECTOR
;
; Description : This is the CPUs exception vector. The CPU jumps here in case of:
;
; (1) reset
;
; (2) interrupts/exceptions
;
; (3) user tlb miss
;