support task self delete for STM8, add a sample of shell for STM8
1. sample project, see TencentOS-tiny\board\STM8L052R8T6\IAR\shell 2. ATTENTION: read TencentOS-tiny\board\STM8L052R8T6\IAR\shell\README.md first
This commit is contained in:
@@ -50,7 +50,6 @@ typedef uint32_t cpu_hrtimer_t;
|
||||
typedef uint32_t cpu_hrtimer_t;
|
||||
#endif
|
||||
|
||||
//typedef cpu_addr_t size_t;
|
||||
typedef cpu_addr_t cpu_cpsr_t;
|
||||
|
||||
#endif
|
||||
|
@@ -50,7 +50,6 @@ typedef uint32_t cpu_hrtimer_t;
|
||||
typedef uint32_t cpu_hrtimer_t;
|
||||
#endif
|
||||
|
||||
//typedef cpu_addr_t size_t;
|
||||
typedef cpu_addr_t cpu_cpsr_t;
|
||||
|
||||
#endif
|
||||
|
@@ -50,7 +50,6 @@ typedef uint32_t cpu_hrtimer_t;
|
||||
typedef uint32_t cpu_hrtimer_t;
|
||||
#endif
|
||||
|
||||
//typedef cpu_addr_t size_t;
|
||||
typedef cpu_addr_t cpu_cpsr_t;
|
||||
|
||||
#endif
|
||||
|
@@ -50,7 +50,6 @@ typedef uint32_t cpu_hrtimer_t;
|
||||
typedef uint32_t cpu_hrtimer_t;
|
||||
#endif
|
||||
|
||||
//typedef cpu_addr_t size_t;
|
||||
typedef cpu_addr_t cpu_cpsr_t;
|
||||
|
||||
#endif
|
||||
|
@@ -54,7 +54,6 @@ typedef uint32_t cpu_hrtimer_t;
|
||||
typedef uint32_t cpu_hrtimer_t;
|
||||
#endif
|
||||
|
||||
//typedef cpu_addr_t size_t;
|
||||
typedef cpu_addr_t cpu_cpsr_t;
|
||||
|
||||
#endif
|
||||
|
@@ -13,7 +13,6 @@ typedef uint32_t cpu_data_t;
|
||||
typedef uint32_t cpu_addr_t;
|
||||
#endif
|
||||
|
||||
//typedef cpu_addr_t size_t;
|
||||
typedef cpu_addr_t cpu_cpsr_t;
|
||||
|
||||
#endif
|
||||
|
@@ -50,7 +50,6 @@ typedef uint32_t cpu_hrtimer_t;
|
||||
typedef uint32_t cpu_hrtimer_t;
|
||||
#endif
|
||||
|
||||
//typedef cpu_addr_t size_t;
|
||||
typedef cpu_addr_t cpu_cpsr_t;
|
||||
|
||||
#endif
|
||||
|
@@ -50,7 +50,6 @@ typedef uint32_t cpu_hrtimer_t;
|
||||
typedef uint32_t cpu_hrtimer_t;
|
||||
#endif
|
||||
|
||||
//typedef cpu_addr_t size_t;
|
||||
typedef cpu_addr_t cpu_cpsr_t;
|
||||
|
||||
#endif
|
||||
|
@@ -210,6 +210,9 @@ __KNL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
}
|
||||
#endif
|
||||
|
||||
*--sp = (cpu_data_t)((uint16_t)exit & 0xFF); /* LRL */
|
||||
*--sp = (cpu_data_t)(((uint16_t)exit >> 8) & 0xFF); /* LRH */
|
||||
|
||||
*--sp = (cpu_data_t)((uint16_t)entry & 0xFF); /* PCL */
|
||||
*--sp = (cpu_data_t)(((uint16_t)entry >> 8) & 0xFF); /* PCH */
|
||||
|
||||
|
@@ -40,7 +40,6 @@ port_cpsr_restore
|
||||
*/
|
||||
PUSH A
|
||||
POP CC
|
||||
RIM
|
||||
RET
|
||||
|
||||
|
||||
|
17
board/STM8L052R8T6/BSP/src/hal_uart.c
Normal file
17
board/STM8L052R8T6/BSP/src/hal_uart.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "tos_hal.h"
|
||||
#include "stm8l15x.h"
|
||||
|
||||
int tos_hal_uart_init(hal_uart_t *uart, hal_uart_port_t port)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int tos_hal_uart_write(hal_uart_t *uart, const uint8_t *buf, size_t size, uint32_t timeout)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < size; ++i) {
|
||||
UART1_Send_Byte(buf[i]);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,20 @@
|
||||
#include "stm8l15x.h"
|
||||
#include "uart.h"
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
const uint8_t HEX_TABLE[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
||||
|
||||
int putchar(int c) {
|
||||
if('\n' == (char)c) {
|
||||
USART_SendData8(USART1, '\r');
|
||||
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
|
||||
}
|
||||
USART_SendData8(USART1, c);
|
||||
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
|
||||
return (c);
|
||||
}
|
||||
|
||||
void UART1_Send_Byte(uint8_t ucData)
|
||||
{
|
||||
USART_SendData8(USART1, ucData);
|
||||
@@ -98,18 +110,21 @@ void UART1_Send_Dec(unsigned int num, unsigned char ucNumCount)
|
||||
|
||||
void UART1_Init(uint32_t uiBaudRate)
|
||||
{
|
||||
//INIT UART1 PINS
|
||||
GPIO_Init(GPIOC, GPIO_Pin_3, GPIO_Mode_Out_PP_High_Fast);
|
||||
GPIO_Init(GPIOC, GPIO_Pin_2, GPIO_Mode_In_PU_No_IT);
|
||||
GPIO_SetBits(GPIOC, GPIO_Pin_3);
|
||||
// INIT UART1 PINS
|
||||
GPIO_Init(GPIOC, GPIO_Pin_3, GPIO_Mode_Out_PP_High_Fast);
|
||||
GPIO_Init(GPIOC, GPIO_Pin_2, GPIO_Mode_In_PU_No_IT);
|
||||
GPIO_SetBits(GPIOC, GPIO_Pin_3);
|
||||
|
||||
//enable UART1 Clock
|
||||
CLK_PeripheralClockConfig(CLK_Peripheral_USART1, ENABLE);
|
||||
// enable UART1 Clock
|
||||
CLK_PeripheralClockConfig(CLK_Peripheral_USART1, ENABLE);
|
||||
|
||||
//setting the UART1
|
||||
USART_Init(USART1, uiBaudRate, USART_WordLength_8b, USART_StopBits_1, USART_Parity_No,
|
||||
(USART_Mode_TypeDef)(USART_Mode_Tx | USART_Mode_Rx));
|
||||
// setting the UART1
|
||||
USART_Init(USART1, uiBaudRate, USART_WordLength_8b, USART_StopBits_1, USART_Parity_No,
|
||||
(USART_Mode_TypeDef)(USART_Mode_Tx | USART_Mode_Rx));
|
||||
|
||||
//enable UART1
|
||||
USART_Cmd(USART1, ENABLE);
|
||||
}
|
||||
// enable RX interrupt
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
|
||||
|
||||
// enable UART1
|
||||
USART_Cmd(USART1, ENABLE);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@@ -49,7 +49,7 @@
|
||||
<MultiCoreRunAll>1</MultiCoreRunAll>
|
||||
</Simulator>
|
||||
<DebugChecksum>
|
||||
<Checksum>941507234</Checksum>
|
||||
<Checksum>4271934099</Checksum>
|
||||
</DebugChecksum>
|
||||
<CallStack>
|
||||
<ShowArgs>0</ShowArgs>
|
||||
@@ -96,8 +96,9 @@
|
||||
<Bp21>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.293.5" 0 0 0 0 "" 0 ""</Bp21>
|
||||
<Bp22>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.293.5" 0 0 0 0 "" 0 ""</Bp22>
|
||||
<Bp23>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.299.9" 0 0 0 0 "" 0 ""</Bp23>
|
||||
<Bp24>_ "STD_CODE" "{$PROJ_DIR$\..\..\USER\stm8l15x_it.c}.293.5" 1 0 0 0 "" 0 ""</Bp24>
|
||||
<Count>25</Count>
|
||||
<Bp24>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.94.5" 0 0 0 0 "" 0 ""</Bp24>
|
||||
<Bp25>_ "STD_CODE" "{$PROJ_DIR$\..\..\USER\main.c}.94.5" 1 0 0 0 "" 0 ""</Bp25>
|
||||
<Count>26</Count>
|
||||
</Breakpoints>
|
||||
<Aliases>
|
||||
<Count>0</Count>
|
||||
|
File diff suppressed because one or more lines are too long
7
board/STM8L052R8T6/IAR/shell/README.md
Normal file
7
board/STM8L052R8T6/IAR/shell/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
- set your uart's baudrate to 9600, too high may not work
|
||||
|
||||
- replace all the tos_mmheap_alloc in tos_shell.c with malloc
|
||||
|
||||
replace all the tos_mmheap_free in tos_shell.c with free
|
||||
|
||||
That means we would not use tos_mmheap in STM8
|
@@ -0,0 +1,40 @@
|
||||
@REM This batch file has been generated by the IAR Embedded Workbench
|
||||
@REM C-SPY Debugger, as an aid to preparing a command line for running
|
||||
@REM the cspybat command line utility using the appropriate settings.
|
||||
@REM
|
||||
@REM Note that this file is generated every time a new debug session
|
||||
@REM is initialized, so you may want to move or rename the file before
|
||||
@REM making changes.
|
||||
@REM
|
||||
@REM You can launch cspybat by typing the name of this batch file followed
|
||||
@REM by the name of the debug file (usually an ELF/DWARF or UBROF file).
|
||||
@REM
|
||||
@REM Read about available command line parameters in the C-SPY Debugging
|
||||
@REM Guide. Hints about additional command line parameters that may be
|
||||
@REM useful in specific cases:
|
||||
@REM --download_only Downloads a code image without starting a debug
|
||||
@REM session afterwards.
|
||||
@REM --silent Omits the sign-on message.
|
||||
@REM --timeout Limits the maximum allowed execution time.
|
||||
@REM
|
||||
|
||||
|
||||
@echo off
|
||||
|
||||
if not "%~1" == "" goto debugFile
|
||||
|
||||
@echo on
|
||||
|
||||
"D:\Program Files\Embedded Workbench 8.3 STM8\common\bin\cspybat" -f "D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\settings\stm8_project.Debug.general.xcl" --backend -f "D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\settings\stm8_project.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
goto end
|
||||
|
||||
:debugFile
|
||||
|
||||
@echo on
|
||||
|
||||
"D:\Program Files\Embedded Workbench 8.3 STM8\common\bin\cspybat" -f "D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\settings\stm8_project.Debug.general.xcl" "--debug_file=%~1" --backend -f "D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\settings\stm8_project.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
:end
|
@@ -0,0 +1,31 @@
|
||||
param([String]$debugfile = "");
|
||||
|
||||
# This powershell file has been generated by the IAR Embedded Workbench
|
||||
# C - SPY Debugger, as an aid to preparing a command line for running
|
||||
# the cspybat command line utility using the appropriate settings.
|
||||
#
|
||||
# Note that this file is generated every time a new debug session
|
||||
# is initialized, so you may want to move or rename the file before
|
||||
# making changes.
|
||||
#
|
||||
# You can launch cspybat by typing Powershell.exe -File followed by the name of this batch file, followed
|
||||
# by the name of the debug file (usually an ELF / DWARF or UBROF file).
|
||||
#
|
||||
# Read about available command line parameters in the C - SPY Debugging
|
||||
# Guide. Hints about additional command line parameters that may be
|
||||
# useful in specific cases :
|
||||
# --download_only Downloads a code image without starting a debug
|
||||
# session afterwards.
|
||||
# --silent Omits the sign - on message.
|
||||
# --timeout Limits the maximum allowed execution time.
|
||||
#
|
||||
|
||||
|
||||
if ($debugfile -eq "")
|
||||
{
|
||||
& "D:\Program Files\Embedded Workbench 8.3 STM8\common\bin\cspybat" -f "D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\settings\stm8_project.Debug.general.xcl" --backend -f "D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\settings\stm8_project.Debug.driver.xcl"
|
||||
}
|
||||
else
|
||||
{
|
||||
& "D:\Program Files\Embedded Workbench 8.3 STM8\common\bin\cspybat" -f "D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\settings\stm8_project.Debug.general.xcl" --debug_file=$debugfile --backend -f "D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\settings\stm8_project.Debug.driver.xcl"
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
"-p"
|
||||
|
||||
"D:\Program Files\Embedded Workbench 8.3 STM8\stm8\config\ddf\iostm8l052r8.ddf"
|
||||
|
||||
"--mcuname"
|
||||
|
||||
"STM8L052R8"
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,11 @@
|
||||
"D:\Program Files\Embedded Workbench 8.3 STM8\stm8\bin\stm8proc.dll"
|
||||
|
||||
"D:\Program Files\Embedded Workbench 8.3 STM8\stm8\bin\stm8stlink.dll"
|
||||
|
||||
"D:\TOS\TencentOS-tiny\board\STM8L052R8T6\IAR\shell\Debug\Exe\stm8_project.out"
|
||||
|
||||
--plugin="D:\Program Files\Embedded Workbench 8.3 STM8\stm8\bin\stm8bat.dll"
|
||||
|
||||
|
||||
|
||||
|
899
board/STM8L052R8T6/IAR/shell/settings/stm8_project.dbgdt
Normal file
899
board/STM8L052R8T6/IAR/shell/settings/stm8_project.dbgdt
Normal file
File diff suppressed because one or more lines are too long
114
board/STM8L052R8T6/IAR/shell/settings/stm8_project.dnx
Normal file
114
board/STM8L052R8T6/IAR/shell/settings/stm8_project.dnx
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0"?>
|
||||
<settings>
|
||||
<Stack>
|
||||
<FillEnabled>0</FillEnabled>
|
||||
<OverflowWarningsEnabled>1</OverflowWarningsEnabled>
|
||||
<WarningThreshold>90</WarningThreshold>
|
||||
<SpWarningsEnabled>1</SpWarningsEnabled>
|
||||
<WarnLogOnly>1</WarnLogOnly>
|
||||
<UseTrigger>1</UseTrigger>
|
||||
<TriggerName>main</TriggerName>
|
||||
<LimitSize>0</LimitSize>
|
||||
<ByteLimit>50</ByteLimit>
|
||||
</Stack>
|
||||
<Trace1>
|
||||
<Enabled>0</Enabled>
|
||||
<ShowSource>1</ShowSource>
|
||||
</Trace1>
|
||||
<InterruptLog>
|
||||
<LogEnabled>0</LogEnabled>
|
||||
<GraphEnabled>0</GraphEnabled>
|
||||
<ShowTimeLog>1</ShowTimeLog>
|
||||
<SumEnabled>0</SumEnabled>
|
||||
<ShowTimeSum>1</ShowTimeSum>
|
||||
<SumSortOrder>0</SumSortOrder>
|
||||
</InterruptLog>
|
||||
<DataLog>
|
||||
<LogEnabled>0</LogEnabled>
|
||||
<GraphEnabled>0</GraphEnabled>
|
||||
<ShowTimeLog>1</ShowTimeLog>
|
||||
<SumEnabled>0</SumEnabled>
|
||||
<ShowTimeSum>1</ShowTimeSum>
|
||||
</DataLog>
|
||||
<Breakpoints2>
|
||||
<Count>0</Count>
|
||||
</Breakpoints2>
|
||||
<Interrupts>
|
||||
<Enabled>1</Enabled>
|
||||
</Interrupts>
|
||||
<MemConfig>
|
||||
<Base>1</Base>
|
||||
<Manual>0</Manual>
|
||||
<Ddf>1</Ddf>
|
||||
<TypeViol>0</TypeViol>
|
||||
<Stop>1</Stop>
|
||||
</MemConfig>
|
||||
<Simulator>
|
||||
<Freq>16000000</Freq>
|
||||
<FreqHi>0</FreqHi>
|
||||
<MultiCoreRunAll>1</MultiCoreRunAll>
|
||||
</Simulator>
|
||||
<DebugChecksum>
|
||||
<Checksum>407403705</Checksum>
|
||||
</DebugChecksum>
|
||||
<CallStack>
|
||||
<ShowArgs>0</ShowArgs>
|
||||
</CallStack>
|
||||
<Disassembly>
|
||||
<MixedMode>1</MixedMode>
|
||||
</Disassembly>
|
||||
<DataSample>
|
||||
<LogEnabled>0</LogEnabled>
|
||||
<GraphEnabled>0</GraphEnabled>
|
||||
<ShowTimeLog>1</ShowTimeLog>
|
||||
</DataSample>
|
||||
<TermIOLog>
|
||||
<LoggingEnabled>_ 0</LoggingEnabled>
|
||||
<LogFile>_ ""</LogFile>
|
||||
</TermIOLog>
|
||||
<LogFile>
|
||||
<LoggingEnabled>_ 0</LoggingEnabled>
|
||||
<LogFile>_ ""</LogFile>
|
||||
<Category>_ 0</Category>
|
||||
</LogFile>
|
||||
<Breakpoints>
|
||||
<Bp0>_ "STD_CODE" "0x008960" 0 0 0 0 "" 0 ""</Bp0>
|
||||
<Bp1>_ "STD_CODE" "0x008961" 0 0 0 0 "" 0 ""</Bp1>
|
||||
<Bp2>_ "STD_CODE" "0x0088AE" 0 0 0 0 "" 0 ""</Bp2>
|
||||
<Bp3>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\kernel\core\tos_task.c}.351.5" 0 0 0 0 "" 0 ""</Bp3>
|
||||
<Bp4>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.238.1" 0 0 0 0 "" 0 ""</Bp4>
|
||||
<Bp5>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.85.9" 0 0 0 0 "" 0 ""</Bp5>
|
||||
<Bp6>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.211.1" 0 0 0 0 "" 0 ""</Bp6>
|
||||
<Bp7>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.238.1" 0 0 0 0 "" 0 ""</Bp7>
|
||||
<Bp8>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.232.1" 0 0 0 0 "" 0 ""</Bp8>
|
||||
<Bp9>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.232.1" 0 0 0 0 "" 0 ""</Bp9>
|
||||
<Bp10>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.138.5" 0 0 0 0 "" 0 ""</Bp10>
|
||||
<Bp11>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.106.9" 0 0 0 0 "" 0 ""</Bp11>
|
||||
<Bp12>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.96.1" 0 0 0 0 "" 0 ""</Bp12>
|
||||
<Bp13>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.149.5" 0 0 0 0 "" 0 ""</Bp13>
|
||||
<Bp14>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.107.9" 0 0 0 0 "" 0 ""</Bp14>
|
||||
<Bp15>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.293.5" 0 0 0 0 "" 0 ""</Bp15>
|
||||
<Bp16>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.100.1" 0 0 0 0 "" 0 ""</Bp16>
|
||||
<Bp17>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.91.1" 0 0 0 0 "" 0 ""</Bp17>
|
||||
<Bp18>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.96.1" 0 0 0 0 "" 0 ""</Bp18>
|
||||
<Bp19>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.293.5" 0 0 0 0 "" 0 ""</Bp19>
|
||||
<Bp20>_ "STD_CODE" "{D:\TOS\TencentOS-tiny}.293.5" 0 0 0 0 "" 0 ""</Bp20>
|
||||
<Bp21>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.293.5" 0 0 0 0 "" 0 ""</Bp21>
|
||||
<Bp22>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.299.9" 0 0 0 0 "" 0 ""</Bp22>
|
||||
<Bp23>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.439.5" 0 0 0 0 "" 0 ""</Bp23>
|
||||
<Bp24>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\components\shell\tos_shell.c}.129.13" 1 0 0 0 "" 0 ""</Bp24>
|
||||
<Bp25>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\components\shell\tos_shell.c}.138.11" 1 0 0 0 "" 0 ""</Bp25>
|
||||
<Bp26>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\board\STM8L052R8T6}.441.5" 0 0 0 0 "" 0 ""</Bp26>
|
||||
<Bp27>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\components\shell\tos_shell.c}.33.5" 1 0 0 0 "" 0 ""</Bp27>
|
||||
<Bp28>_ "STD_CODE" "{D:\TOS\TencentOS-tiny\components\shell\tos_shell.c}.222.1" 1 0 0 0 "" 0 ""</Bp28>
|
||||
<Count>29</Count>
|
||||
</Breakpoints>
|
||||
<Aliases>
|
||||
<Count>0</Count>
|
||||
<SuppressDialog>0</SuppressDialog>
|
||||
</Aliases>
|
||||
<DebuggerSettings>
|
||||
<DisableInterruptsWhenStepping>0</DisableInterruptsWhenStepping>
|
||||
<LeaveTargetRunning>0</LeaveTargetRunning>
|
||||
</DebuggerSettings>
|
||||
</settings>
|
@@ -0,0 +1 @@
|
||||
|
448
board/STM8L052R8T6/IAR/shell/settings/stm8_project.wsdt
Normal file
448
board/STM8L052R8T6/IAR/shell/settings/stm8_project.wsdt
Normal file
File diff suppressed because one or more lines are too long
454
board/STM8L052R8T6/IAR/shell/stm8_project.ewd
Normal file
454
board/STM8L052R8T6/IAR/shell/stm8_project.ewd
Normal file
@@ -0,0 +1,454 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project>
|
||||
<fileVersion>3</fileVersion>
|
||||
<configuration>
|
||||
<name>Debug</name>
|
||||
<toolchain>
|
||||
<name>STM8</name>
|
||||
</toolchain>
|
||||
<debug>1</debug>
|
||||
<settings>
|
||||
<name>C-SPY</name>
|
||||
<archiveVersion>1</archiveVersion>
|
||||
<data>
|
||||
<version>1</version>
|
||||
<wantNonLocal>1</wantNonLocal>
|
||||
<debug>1</debug>
|
||||
<option>
|
||||
<name>CSpyMandatory</name>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyInput</name>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyRunToEnable</name>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyRunToName</name>
|
||||
<state>main</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyMacOverride</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyMacFile</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>DynDriver</name>
|
||||
<state>STLINK_STM8</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyDDFOverride</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyDDFFile</name>
|
||||
<state>$TOOLKIT_DIR$\config\ddf\iostm8l052r8.ddf</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyEnableExtraOptions</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyExtraOptions</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesSuppressCheck1</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesPath1</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesSuppressCheck2</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesPath2</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesSuppressCheck3</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesPath3</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesOffset1</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesOffset2</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesOffset3</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesUse1</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesUse2</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesUse3</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
</data>
|
||||
</settings>
|
||||
<settings>
|
||||
<name>SIMULATOR_STM8</name>
|
||||
<archiveVersion>1</archiveVersion>
|
||||
<data>
|
||||
<version>0</version>
|
||||
<wantNonLocal>1</wantNonLocal>
|
||||
<debug>1</debug>
|
||||
<option>
|
||||
<name>SimMandatory</name>
|
||||
<state>1</state>
|
||||
</option>
|
||||
</data>
|
||||
</settings>
|
||||
<settings>
|
||||
<name>STICE_STM8</name>
|
||||
<archiveVersion>3</archiveVersion>
|
||||
<data>
|
||||
<version>2</version>
|
||||
<wantNonLocal>1</wantNonLocal>
|
||||
<debug>1</debug>
|
||||
<option>
|
||||
<name>STiceMandatory</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceSuppressLoad</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceVerifyLoad</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceLogFileOver</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceLogFile</name>
|
||||
<state>$PROJ_DIR$\cspycomm.log</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceUseSwim</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceOptionBytesSetupFileOver</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceOptionBytesSetupFile</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceEraseMemory</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
</data>
|
||||
</settings>
|
||||
<settings>
|
||||
<name>STLINK_STM8</name>
|
||||
<archiveVersion>3</archiveVersion>
|
||||
<data>
|
||||
<version>2</version>
|
||||
<wantNonLocal>1</wantNonLocal>
|
||||
<debug>1</debug>
|
||||
<option>
|
||||
<name>STlinkMandatory</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkSuppressLoad</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkVerifyLoad</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkLogFileOver</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkLogFile</name>
|
||||
<state>$PROJ_DIR$\cspycomm.log</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkOptionBytesSetupFileOver</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkOptionBytesSetupFile</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkEraseMemory</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
</data>
|
||||
</settings>
|
||||
<debuggerPlugins>
|
||||
<plugin>
|
||||
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
|
||||
<loadFlag>0</loadFlag>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
|
||||
<loadFlag>0</loadFlag>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<file>$EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin</file>
|
||||
<loadFlag>0</loadFlag>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>
|
||||
<loadFlag>0</loadFlag>
|
||||
</plugin>
|
||||
</debuggerPlugins>
|
||||
</configuration>
|
||||
<configuration>
|
||||
<name>Release</name>
|
||||
<toolchain>
|
||||
<name>STM8</name>
|
||||
</toolchain>
|
||||
<debug>0</debug>
|
||||
<settings>
|
||||
<name>C-SPY</name>
|
||||
<archiveVersion>1</archiveVersion>
|
||||
<data>
|
||||
<version>1</version>
|
||||
<wantNonLocal>1</wantNonLocal>
|
||||
<debug>0</debug>
|
||||
<option>
|
||||
<name>CSpyMandatory</name>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyInput</name>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyRunToEnable</name>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyRunToName</name>
|
||||
<state>main</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyMacOverride</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyMacFile</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>DynDriver</name>
|
||||
<state>SIMULATOR_STM8</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyDDFOverride</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyDDFFile</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyEnableExtraOptions</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyExtraOptions</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesSuppressCheck1</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesPath1</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesSuppressCheck2</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesPath2</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesSuppressCheck3</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesPath3</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesOffset1</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesOffset2</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesOffset3</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesUse1</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesUse2</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CSpyImagesUse3</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
</data>
|
||||
</settings>
|
||||
<settings>
|
||||
<name>SIMULATOR_STM8</name>
|
||||
<archiveVersion>1</archiveVersion>
|
||||
<data>
|
||||
<version>0</version>
|
||||
<wantNonLocal>1</wantNonLocal>
|
||||
<debug>0</debug>
|
||||
<option>
|
||||
<name>SimMandatory</name>
|
||||
<state>1</state>
|
||||
</option>
|
||||
</data>
|
||||
</settings>
|
||||
<settings>
|
||||
<name>STICE_STM8</name>
|
||||
<archiveVersion>3</archiveVersion>
|
||||
<data>
|
||||
<version>2</version>
|
||||
<wantNonLocal>1</wantNonLocal>
|
||||
<debug>0</debug>
|
||||
<option>
|
||||
<name>STiceMandatory</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceSuppressLoad</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceVerifyLoad</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceLogFileOver</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceLogFile</name>
|
||||
<state>$PROJ_DIR$\cspycomm.log</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceUseSwim</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceOptionBytesSetupFileOver</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceOptionBytesSetupFile</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STiceEraseMemory</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
</data>
|
||||
</settings>
|
||||
<settings>
|
||||
<name>STLINK_STM8</name>
|
||||
<archiveVersion>3</archiveVersion>
|
||||
<data>
|
||||
<version>2</version>
|
||||
<wantNonLocal>1</wantNonLocal>
|
||||
<debug>0</debug>
|
||||
<option>
|
||||
<name>STlinkMandatory</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkSuppressLoad</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkVerifyLoad</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkLogFileOver</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkLogFile</name>
|
||||
<state>$PROJ_DIR$\cspycomm.log</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkOptionBytesSetupFileOver</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkOptionBytesSetupFile</name>
|
||||
<state></state>
|
||||
</option>
|
||||
<option>
|
||||
<name>STlinkEraseMemory</name>
|
||||
<state>0</state>
|
||||
</option>
|
||||
</data>
|
||||
</settings>
|
||||
<debuggerPlugins>
|
||||
<plugin>
|
||||
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
|
||||
<loadFlag>0</loadFlag>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
|
||||
<loadFlag>0</loadFlag>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<file>$EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin</file>
|
||||
<loadFlag>0</loadFlag>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>
|
||||
<loadFlag>0</loadFlag>
|
||||
</plugin>
|
||||
</debuggerPlugins>
|
||||
</configuration>
|
||||
</project>
|
1969
board/STM8L052R8T6/IAR/shell/stm8_project.ewp
Normal file
1969
board/STM8L052R8T6/IAR/shell/stm8_project.ewp
Normal file
File diff suppressed because it is too large
Load Diff
2481
board/STM8L052R8T6/IAR/shell/stm8_project.ewt
Normal file
2481
board/STM8L052R8T6/IAR/shell/stm8_project.ewt
Normal file
File diff suppressed because it is too large
Load Diff
7
board/STM8L052R8T6/IAR/shell/stm8_project.eww
Normal file
7
board/STM8L052R8T6/IAR/shell/stm8_project.eww
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\stm8_project.ewp</path>
|
||||
</project>
|
||||
<batchBuild />
|
||||
</workspace>
|
@@ -4,9 +4,9 @@
|
||||
* @author MCD Application Team
|
||||
* @version V1.6.1
|
||||
* @date 30-September-2014
|
||||
* @brief This file provides firmware functions to manage the following
|
||||
* @brief This file provides firmware functions to manage the following
|
||||
* functionalities of the Universal synchronous asynchronous receiver
|
||||
* transmitter (USART):
|
||||
* transmitter (USART):
|
||||
* - Initialization and Configuration
|
||||
* - Data transfers
|
||||
* - Multi-Processor Communication
|
||||
@@ -14,10 +14,10 @@
|
||||
* - Smartcard mode
|
||||
* - IrDA mode
|
||||
* - DMA transfers management
|
||||
* - Interrupts and flags management
|
||||
*
|
||||
* - Interrupts and flags management
|
||||
*
|
||||
* @verbatim
|
||||
*
|
||||
*
|
||||
* ===================================================================
|
||||
* How to use this driver
|
||||
* ===================================================================
|
||||
@@ -27,7 +27,7 @@
|
||||
*
|
||||
* 2. Enable the external Pull-up on the used USART Pins using the
|
||||
* GPIO_ExternalPullUpConfig() function or an external pull-up equivalent resistor
|
||||
* (RPU = 45 KOhm typical value).
|
||||
* (RPU = 45 KOhm typical value).
|
||||
*
|
||||
* 3. Program the Baud Rate, Word Length , Stop Bit, Parity and Mode (Receiver/Transmitter)
|
||||
* using the USART_Init() function.
|
||||
@@ -35,21 +35,21 @@
|
||||
* 4. For synchronous mode, enable the clock and program the polarity,
|
||||
* phase and last bit using the USART_ClockInit() function.
|
||||
*
|
||||
* 5. Enable the corresponding interrupt using the function USART_ITConfig() if you need
|
||||
* to use interrupt mode.
|
||||
* 5. Enable the corresponding interrupt using the function USART_ITConfig() if you need
|
||||
* to use interrupt mode.
|
||||
*
|
||||
* 6. When using the DMA mode
|
||||
* 6. When using the DMA mode
|
||||
* - Configure the DMA using DMA_Init() function
|
||||
* - Activate the needed channel Request using USART_DMACmd() function
|
||||
*
|
||||
*
|
||||
* 7. Enable the USART using the USART_Cmd() function.
|
||||
*
|
||||
* 8. Enable the DMA using the DMA_Cmd() function, when using DMA mode.
|
||||
*
|
||||
* 8. Enable the DMA using the DMA_Cmd() function, when using DMA mode.
|
||||
*
|
||||
* Refer to Multi-Processor, half-duplex, Smartcard, IrDA sub-sections for more details.
|
||||
*
|
||||
*
|
||||
* @endverbatim
|
||||
*
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
@@ -61,14 +61,14 @@
|
||||
*
|
||||
* http://www.st.com/software_license_agreement_liberty_v2
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm8l15x_usart.h"
|
||||
@@ -77,11 +77,11 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USART
|
||||
/** @defgroup USART
|
||||
* @brief USART driver modules
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
@@ -94,46 +94,46 @@
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Group1 Initialization and Configuration functions
|
||||
* @brief Initialization and Configuration functions
|
||||
* @brief Initialization and Configuration functions
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
Initialization and Configuration functions
|
||||
===============================================================================
|
||||
===============================================================================
|
||||
|
||||
This subsection provides a set of functions allowing to initialize the USART
|
||||
This subsection provides a set of functions allowing to initialize the USART
|
||||
in asynchronous and in synchronous modes.
|
||||
- For the asynchronous mode only these parameters can be configured:
|
||||
- For the asynchronous mode only these parameters can be configured:
|
||||
- Baud Rate
|
||||
- Word Length
|
||||
- Word Length
|
||||
- Stop Bit
|
||||
- Parity: If the parity is enabled, then the MSB bit of the data written
|
||||
in the data register is transmitted but is changed by the parity bit.
|
||||
Depending on the frame length defined by the M bit (8-bits or 9-bits),
|
||||
the possible USART frame formats are as listed in the following table:
|
||||
+-------------------------------------------------------------+
|
||||
+-------------------------------------------------------------+
|
||||
| M bit | PCE bit | USART frame |
|
||||
|---------------------|---------------------------------------|
|
||||
|---------------------|---------------------------------------|
|
||||
| 0 | 0 | | SB | 8 bit data | STB | |
|
||||
|---------|-----------|---------------------------------------|
|
||||
|---------|-----------|---------------------------------------|
|
||||
| 0 | 1 | | SB | 7 bit data | PB | STB | |
|
||||
|---------|-----------|---------------------------------------|
|
||||
|---------|-----------|---------------------------------------|
|
||||
| 1 | 0 | | SB | 9 bit data | STB | |
|
||||
|---------|-----------|---------------------------------------|
|
||||
|---------|-----------|---------------------------------------|
|
||||
| 1 | 1 | | SB | 8 bit data | PB | STB | |
|
||||
+-------------------------------------------------------------+
|
||||
+-------------------------------------------------------------+
|
||||
- Receiver/transmitter modes
|
||||
|
||||
The USART_Init() function follows the USART asynchronous configuration procedure
|
||||
(details for the procedure are available in reference manual (RM0031)).
|
||||
|
||||
- For the synchronous mode in addition to the asynchronous mode parameters these
|
||||
- For the synchronous mode in addition to the asynchronous mode parameters these
|
||||
parameters should be also configured:
|
||||
- USART Clock Enabled
|
||||
- USART polarity
|
||||
- USART phase
|
||||
- USART LastBit
|
||||
|
||||
|
||||
These parameters can be configured using the USART_ClockInit() function.
|
||||
|
||||
@endverbatim
|
||||
@@ -172,7 +172,7 @@ void USART_DeInit(USART_TypeDef* USARTx)
|
||||
* @param USART_WordLength: the word length
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_WordLength_8b: 8 bits Data
|
||||
* @arg USART_WordLength_9b: 9 bits Data
|
||||
* @arg USART_WordLength_9b: 9 bits Data
|
||||
* @param USART_StopBits: Stop Bit
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_StopBits_1: One stop bit is transmitted at the end of frame
|
||||
@@ -182,11 +182,11 @@ void USART_DeInit(USART_TypeDef* USARTx)
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_Parity_No: No Parity
|
||||
* @arg USART_Parity_Even: Even Parity
|
||||
* @arg USART_Parity_Odd: Odd Parity
|
||||
* @arg USART_Parity_Odd: Odd Parity
|
||||
* @param USART_Mode: Mode
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_Mode_Rx: Receive Enable
|
||||
* @arg USART_Mode_Tx: Transmit Enable
|
||||
* @arg USART_Mode_Tx: Transmit Enable
|
||||
* @retval None
|
||||
*/
|
||||
void USART_Init(USART_TypeDef* USARTx, uint32_t BaudRate, USART_WordLength_TypeDef
|
||||
@@ -244,7 +244,7 @@ void USART_Init(USART_TypeDef* USARTx, uint32_t BaudRate, USART_WordLength_TypeD
|
||||
* @param USART_Clock: Clock
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_Clock_Disable: CK pin disabled
|
||||
* @arg USART_Clock_Enable: CK pin enabled
|
||||
* @arg USART_Clock_Enable: CK pin enabled
|
||||
* @param USART_CPOL: Clock Polarity
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_CPOL_Low: CK to 0 when idle
|
||||
@@ -255,9 +255,9 @@ void USART_Init(USART_TypeDef* USARTx, uint32_t BaudRate, USART_WordLength_TypeD
|
||||
* @arg USART_CPHA_2Edge: The second clock transition is the first data capture edge
|
||||
* @param USART_LastBit: Last Bit
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_LastBit_Disable: The clock pulse of the last data bit is
|
||||
* @arg USART_LastBit_Disable: The clock pulse of the last data bit is
|
||||
* not output to the SCLK pin
|
||||
* @arg USART_LastBit_Enable: The clock pulse of the last data bit is
|
||||
* @arg USART_LastBit_Enable: The clock pulse of the last data bit is
|
||||
* output to the SCLK pin
|
||||
* @retval None
|
||||
*/
|
||||
@@ -311,7 +311,7 @@ void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
* @note This function is related to SmartCard and IrDa mode.
|
||||
* @param USARTx: Select the USARTx peripheral.
|
||||
* @param USART_Prescaler: specifies the prescaler clock.
|
||||
* @note In IrDA Low Power Mode the clock source is divided by the value given
|
||||
* @note In IrDA Low Power Mode the clock source is divided by the value given
|
||||
* in the register (8 bits)
|
||||
* - 0000 0000 Reserved
|
||||
* - 0000 0001 divides the clock source by 1
|
||||
@@ -347,27 +347,27 @@ void USART_SendBreak(USART_TypeDef* USARTx)
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Group2 Data transfers functions
|
||||
* @brief Data transfers functions
|
||||
* @brief Data transfers functions
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
Data transfers functions
|
||||
===============================================================================
|
||||
===============================================================================
|
||||
|
||||
This subsection provides a set of functions allowing to manage the USART data
|
||||
This subsection provides a set of functions allowing to manage the USART data
|
||||
transfers.
|
||||
|
||||
During an USART reception, data shifts in least significant bit first through
|
||||
the RX pin. In this mode, the USART_DR register is similar to a buffer (RDR)
|
||||
|
||||
During an USART reception, data shifts in least significant bit first through
|
||||
the RX pin. In this mode, the USART_DR register is similar to a buffer (RDR)
|
||||
between the internal bus and the received shift register.
|
||||
|
||||
When a transmission is taking place, a write instruction to the USART_DR register
|
||||
stores the data in the TDR register which is copied in the shift register
|
||||
When a transmission is taking place, a write instruction to the USART_DR register
|
||||
stores the data in the TDR register which is copied in the shift register
|
||||
at the end of the current transmission.
|
||||
|
||||
The read access of the USART_DR register can be done using the USART_ReceiveData8()
|
||||
or USART_ReceiveData9() functions and returns the RDR buffered value. Whereas a write
|
||||
access to the USART_DR can be done using USART_SendData8() or USART_SendData9()
|
||||
access to the USART_DR can be done using USART_SendData8() or USART_SendData9()
|
||||
functions and stores the written data into TDR buffer.
|
||||
|
||||
@endverbatim
|
||||
@@ -433,22 +433,22 @@ void USART_SendData9(USART_TypeDef* USARTx, uint16_t Data)
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Group3 MultiProcessor Communication functions
|
||||
* @brief Multi-Processor Communication functions
|
||||
* @brief Multi-Processor Communication functions
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
Multi-Processor Communication functions
|
||||
===============================================================================
|
||||
===============================================================================
|
||||
|
||||
This subsection provides a set of functions allowing to manage the USART
|
||||
This subsection provides a set of functions allowing to manage the USART
|
||||
multiprocessor communication.
|
||||
|
||||
For instance one of the USARTs can be the master, its TX output is connected to
|
||||
the RX input of the other USART. The others are slaves, their respective TX outputs
|
||||
|
||||
For instance one of the USARTs can be the master, its TX output is connected to
|
||||
the RX input of the other USART. The others are slaves, their respective TX outputs
|
||||
are logically ANDed together and connected to the RX input of the master.
|
||||
|
||||
USART multiprocessor communication is possible through the following procedure:
|
||||
1. Program the Baud rate, Word length = 9 bits, Stop bits, Parity, Mode transmitter
|
||||
1. Program the Baud rate, Word length = 9 bits, Stop bits, Parity, Mode transmitter
|
||||
or Mode receiver and hardware flow control values using the USART_Init()
|
||||
function.
|
||||
2. Configures the USART address using the USART_SetAddress() function.
|
||||
@@ -462,7 +462,7 @@ void USART_SendData9(USART_TypeDef* USARTx, uint16_t Data)
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Determines if the USART is in mute mode or not.
|
||||
* @param USARTx: where x can be 1 to select the specified USART peripheral.
|
||||
@@ -509,7 +509,7 @@ void USART_SetAddress(USART_TypeDef* USARTx, uint8_t USART_Address)
|
||||
* @param USART_WakeUp: Specifies the USART wakeup method.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_WakeUp_IdleLine: 0x01 Idle Line wake up
|
||||
* @arg USART_WakeUp_AddressMark: 0x02 Address Mark wake up
|
||||
* @arg USART_WakeUp_AddressMark: 0x02 Address Mark wake up
|
||||
* @retval None
|
||||
*/
|
||||
void USART_WakeUpConfig(USART_TypeDef* USARTx, USART_WakeUp_TypeDef USART_WakeUp)
|
||||
@@ -524,21 +524,21 @@ void USART_WakeUpConfig(USART_TypeDef* USARTx, USART_WakeUp_TypeDef USART_WakeUp
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Group4 Halfduplex mode function
|
||||
* @brief Half-duplex mode function
|
||||
* @brief Half-duplex mode function
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
Half-duplex mode function
|
||||
===============================================================================
|
||||
===============================================================================
|
||||
|
||||
This subsection provides a function allowing to manage the USART
|
||||
This subsection provides a function allowing to manage the USART
|
||||
Half-duplex communication.
|
||||
|
||||
The USART can be configured to follow a single-wire half-duplex protocol where
|
||||
|
||||
The USART can be configured to follow a single-wire half-duplex protocol where
|
||||
the TX and RX lines are internally connected.
|
||||
|
||||
USART Half duplex communication is possible through the following procedure:
|
||||
1. Program the Baud rate, Word length, Stop bits, Parity, Mode transmitter
|
||||
1. Program the Baud rate, Word length, Stop bits, Parity, Mode transmitter
|
||||
or Mode receiver and hardware flow control values using the USART_Init()
|
||||
function.
|
||||
2. Configures the USART address using the USART_SetAddress() function.
|
||||
@@ -582,21 +582,21 @@ void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Group5 Smartcard mode functions
|
||||
* @brief Smartcard mode functions
|
||||
* @brief Smartcard mode functions
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
Smartcard mode functions
|
||||
===============================================================================
|
||||
===============================================================================
|
||||
|
||||
This subsection provides a set of functions allowing to manage the USART
|
||||
This subsection provides a set of functions allowing to manage the USART
|
||||
Smartcard communication.
|
||||
|
||||
|
||||
The Smartcard interface is designed to support asynchronous protocol Smartcards as
|
||||
defined in the ISO 7816-3 standard.
|
||||
|
||||
The USART can provide a clock to the smartcard through the SCLK output.
|
||||
In smartcard mode, SCLK is not associated to the communication but is simply derived
|
||||
In smartcard mode, SCLK is not associated to the communication but is simply derived
|
||||
from the internal peripheral input clock through a 5-bit prescaler.
|
||||
|
||||
Smartcard communication is possible through the following procedure:
|
||||
@@ -622,10 +622,10 @@ void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
|
||||
Please refer to the ISO 7816-3 specification for more details.
|
||||
|
||||
Note:
|
||||
Note:
|
||||
-----
|
||||
1. It is also possible to choose 0.5 stop bit for receiving but it is recommended
|
||||
to use 1.5 stop bits for both transmitting and receiving to avoid switching
|
||||
1. It is also possible to choose 0.5 stop bit for receiving but it is recommended
|
||||
to use 1.5 stop bits for both transmitting and receiving to avoid switching
|
||||
between the two configurations.
|
||||
2. In smartcard mode, the following bits must be kept cleared:
|
||||
- HDSEL and IREN bits in the USART_CR5 register.
|
||||
@@ -633,7 +633,7 @@ Note:
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the USART Smart Card mode.
|
||||
* @param USARTx: Select the USARTx peripheral.
|
||||
@@ -698,38 +698,38 @@ void USART_SetGuardTime(USART_TypeDef* USARTx, uint8_t USART_GuardTime)
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Group6 IrDA mode functions
|
||||
* @brief IrDA mode functions
|
||||
* @brief IrDA mode functions
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
IrDA mode functions
|
||||
===============================================================================
|
||||
===============================================================================
|
||||
|
||||
This subsection provides a set of functions allowing to manage the USART
|
||||
This subsection provides a set of functions allowing to manage the USART
|
||||
IrDA communication.
|
||||
|
||||
|
||||
IrDA is a half duplex communication protocol. If the Transmitter is busy, any data
|
||||
on the IrDA receive line will be ignored by the IrDA decoder and if the Receiver
|
||||
on the IrDA receive line will be ignored by the IrDA decoder and if the Receiver
|
||||
is busy, data on the TX from the USART to IrDA will not be encoded by IrDA.
|
||||
While receiving data, transmission should be avoided as the data to be transmitted
|
||||
could be corrupted.
|
||||
|
||||
IrDA communication is possible through the following procedure:
|
||||
1. Program the Baud rate, Word length = 8 bits, Stop bits, Parity, Transmitter/Receiver
|
||||
1. Program the Baud rate, Word length = 8 bits, Stop bits, Parity, Transmitter/Receiver
|
||||
modes and hardware flow control values using the USART_Init() function.
|
||||
2. Enable the USART using the USART_Cmd() function.
|
||||
3. Configures the IrDA pulse width by configuring the prescaler using
|
||||
3. Configures the IrDA pulse width by configuring the prescaler using
|
||||
the USART_SetPrescaler() function.
|
||||
4. Configures the IrDA USART_IrDAMode_LowPower or USART_IrDAMode_Normal mode
|
||||
using the USART_IrDAConfig() function.
|
||||
5. Enable the IrDA using the USART_IrDACmd() function.
|
||||
|
||||
Note:
|
||||
Note:
|
||||
-----
|
||||
1. A pulse of width less than two and greater than one PSC period(s) may or may
|
||||
not be rejected.
|
||||
2. The receiver set up time should be managed by software. The IrDA physical layer
|
||||
specification specifies a minimum of 10 ms delay between transmission and
|
||||
specification specifies a minimum of 10 ms delay between transmission and
|
||||
reception (IrDA is a half duplex protocol).
|
||||
3. In IrDA mode, the following bits must be kept cleared:
|
||||
- STOP and CLKEN bits in the USART_CR3 register.
|
||||
@@ -738,14 +738,14 @@ Note:
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Configures the USART<52>s IrDA interface.
|
||||
* @param USARTx: where x can be 1 to select the specified USART peripheral.
|
||||
* @param USART_IrDAMode specifies the IrDA mode.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_IrDAMode_Normal: IrDA Normal Mode
|
||||
* @arg USART_IrDAMode_LowPower: IrDA Low Power Mode
|
||||
* @arg USART_IrDAMode_LowPower: IrDA Low Power Mode
|
||||
* @retval None
|
||||
*/
|
||||
void USART_IrDAConfig(USART_TypeDef* USARTx, USART_IrDAMode_TypeDef USART_IrDAMode)
|
||||
@@ -794,10 +794,10 @@ void USART_IrDACmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
/** @defgroup USART_Group7 DMA transfers management functions
|
||||
* @brief DMA transfers management functions
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
DMA transfers management functions
|
||||
===============================================================================
|
||||
===============================================================================
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
@@ -810,7 +810,7 @@ void USART_IrDACmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
* @param USART_DMAReq Specifies the USART DMA transfer request to be enabled or disabled.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_DMAReq_TX: Receive DMA request Enable
|
||||
* @arg USART_DMAReq_RX: Transmit DMA request Enable
|
||||
* @arg USART_DMAReq_RX: Transmit DMA request Enable
|
||||
* @param NewState Indicates the new state of the USART DMA request.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @retval None
|
||||
@@ -839,28 +839,28 @@ void USART_DMACmd(USART_TypeDef* USARTx, USART_DMAReq_TypeDef USART_DMAReq,
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USART_Group8 Interrupts and flags management functions
|
||||
* @brief Interrupts and flags management functions
|
||||
* @brief Interrupts and flags management functions
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
Interrupts and flags management functions
|
||||
===============================================================================
|
||||
===============================================================================
|
||||
|
||||
This subsection provides a set of functions allowing to configure the USART
|
||||
Interrupts sources, DMA channels requests and check or clear the flags or
|
||||
This subsection provides a set of functions allowing to configure the USART
|
||||
Interrupts sources, DMA channels requests and check or clear the flags or
|
||||
pending bits status.
|
||||
The user should identify which mode will be used in his application to manage
|
||||
the communication: Polling mode, Interrupt mode or DMA mode.
|
||||
|
||||
The user should identify which mode will be used in his application to manage
|
||||
the communication: Polling mode, Interrupt mode or DMA mode.
|
||||
|
||||
Polling Mode
|
||||
=============
|
||||
In Polling Mode, the USART communication can be managed by 9 flags:
|
||||
1. USART_FLAG_TXE: to indicate the status of the transmit buffer register
|
||||
2. USART_FLAG_RXNE: to indicate the status of the receive buffer register
|
||||
3. USART_FLAG_TC: to indicate the status of the transmit operation
|
||||
4. USART_FLAG_IDLE: to indicate the status of the Idle Line
|
||||
4. USART_FLAG_IDLE: to indicate the status of the Idle Line
|
||||
5. USART_FLAG_SBK: to indicate the status of the Send Break characters
|
||||
6. USART_FLAG_NE: to indicate if a noise error occur
|
||||
7. USART_FLAG_FE: to indicate if a frame error occur
|
||||
@@ -874,32 +874,32 @@ void USART_DMACmd(USART_TypeDef* USARTx, USART_DMAReq_TypeDef USART_DMAReq,
|
||||
Interrupt Mode
|
||||
===============
|
||||
In Interrupt Mode, the USART communication can be managed by 7 interrupt sources
|
||||
and 6 pending bits:
|
||||
and 6 pending bits:
|
||||
|
||||
Pending Bits:
|
||||
-------------
|
||||
-------------
|
||||
1. USART_IT_TXE: to indicate the status of the transmit buffer register
|
||||
2. USART_IT_RXNE: to indicate the status of the receive buffer register
|
||||
3. USART_IT_TC: to indicate the status of the transmit operation
|
||||
4. USART_IT_IDLE: to indicate the status of the Idle Line
|
||||
4. USART_IT_IDLE: to indicate the status of the Idle Line
|
||||
5. USART_IT_PE: to indicate if a parity error occur
|
||||
6. USART_IT_OR: to indicate if an Noise flag, overrun error and framing error in
|
||||
multibuffer communication error occur
|
||||
|
||||
Interrupt Source:
|
||||
-----------------
|
||||
1. USART_IT_TXE: specifies the interrupt source for the Tx buffer empty
|
||||
interrupt.
|
||||
2. USART_IT_RXNE: specifies the interrupt source for the Rx buffer not
|
||||
1. USART_IT_TXE: specifies the interrupt source for the Tx buffer empty
|
||||
interrupt.
|
||||
2. USART_IT_RXNE: specifies the interrupt source for the Rx buffer not
|
||||
empty interrupt.
|
||||
3. USART_IT_TC: specifies the interrupt source for the Transmit complete
|
||||
interrupt.
|
||||
3. USART_IT_TC: specifies the interrupt source for the Transmit complete
|
||||
interrupt.
|
||||
4. USART_IT_IDLE: specifies the interrupt source for the Idle Line interrupt.
|
||||
5. USART_IT_PE: specifies the interrupt source for the parity error interrupt.
|
||||
5. USART_IT_PE: specifies the interrupt source for the parity error interrupt.
|
||||
6. USART_IT_ERR: specifies the interrupt source for the errors interrupt.
|
||||
7. USART_IT_OR: specifies the interrupt source for the overrun error interrupt.
|
||||
|
||||
Note: Some parameters are coded in order to use them as interrupt source or
|
||||
Note: Some parameters are coded in order to use them as interrupt source or
|
||||
---- as pending bits.
|
||||
|
||||
In this Mode it is advised to use the following functions:
|
||||
@@ -989,14 +989,14 @@ void USART_ITConfig(USART_TypeDef* USARTx, USART_IT_TypeDef USART_IT, Functional
|
||||
* @param USART_FLAG specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_FLAG_TXE: Transmit Data Register empty
|
||||
* @arg USART_FLAG_TC: Transmission Complete
|
||||
* @arg USART_FLAG_TC: Transmission Complete
|
||||
* @arg USART_FLAG_RXNE: Read Data Register Not Empty
|
||||
* @arg USART_FLAG_IDLE: Idle line detected
|
||||
* @arg USART_FLAG_OR: OverRun error
|
||||
* @arg USART_FLAG_NF: Noise error
|
||||
* @arg USART_FLAG_FE: Framing Error
|
||||
* @arg USART_FLAG_PE: Parity Error
|
||||
* @arg USART_FLAG_SBK: Send Break characters
|
||||
* @arg USART_FLAG_SBK: Send Break characters
|
||||
* @retval FlagStatus (SET or RESET)
|
||||
*/
|
||||
FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, USART_FLAG_TypeDef USART_FLAG)
|
||||
|
@@ -79,20 +79,13 @@ k_stack_t task1_stack[512];
|
||||
k_task_t task2;
|
||||
k_stack_t task2_stack[512];
|
||||
|
||||
int main(void)
|
||||
#define APPLICATION_TASK_STK_SIZE 1024
|
||||
|
||||
k_task_t task_app;
|
||||
k_stack_t task_app_stack[512];
|
||||
|
||||
__WEAK__ void application_entry(void * arg)
|
||||
{
|
||||
LED_GPIO_Init();
|
||||
UART1_Init(57600); /* Init the UART1, baud rate 57600 */
|
||||
RTC_Setting_Init(); /* Init RTC */
|
||||
|
||||
/* use as systick, interrupt handler see TIM2_UPD_OVF_TRG_BRK_USART2_TX_IRQHandler */
|
||||
Timer2_Init(TOS_CFG_CPU_CLOCK, TOS_CFG_CPU_TICK_PER_SECOND);
|
||||
|
||||
LED_On();
|
||||
UART1_Send_String("welcome to TencentOS tiny!\r\n");
|
||||
|
||||
tos_knl_init();
|
||||
|
||||
tos_task_create(&task1, "task1", task1_entry, NULL,
|
||||
4,
|
||||
task1_stack, sizeof(task1_stack),
|
||||
@@ -102,6 +95,27 @@ int main(void)
|
||||
4,
|
||||
task2_stack, sizeof(task2_stack),
|
||||
0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
LED_GPIO_Init();
|
||||
UART1_Init(9600); /* Init the UART1, baud rate 9600 */
|
||||
RTC_Setting_Init(); /* Init RTC */
|
||||
|
||||
/* use as systick, interrupt handler see TIM2_UPD_OVF_TRG_BRK_USART2_TX_IRQHandler */
|
||||
Timer2_Init(TOS_CFG_CPU_CLOCK, TOS_CFG_CPU_TICK_PER_SECOND);
|
||||
|
||||
LED_On();
|
||||
UART1_Send_String("welcome to TencentOS tiny!\r\n");
|
||||
printf("welcome to TencentOS tiny!\r\n");
|
||||
|
||||
tos_knl_init();
|
||||
|
||||
tos_task_create(&task_app, "app", application_entry, NULL,
|
||||
4,
|
||||
task_app_stack, sizeof(task_app_stack),
|
||||
0);
|
||||
|
||||
tos_knl_start();
|
||||
|
||||
|
@@ -291,7 +291,6 @@ INTERRUPT_HANDLER(TIM2_UPD_OVF_TRG_BRK_USART2_TX_IRQHandler, 19)
|
||||
*/
|
||||
|
||||
TIM2_ClearITPendingBit(TIM2_IT_Update);
|
||||
//UART1_Send_String("tim\r\n");
|
||||
|
||||
if (tos_knl_is_running()) {
|
||||
tos_knl_irq_enter();
|
||||
@@ -433,6 +432,7 @@ INTERRUPT_HANDLER(USART1_RX_TIM5_CC_IRQHandler, 28)
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
|
||||
#ifdef USE_STM8L1526_EVAL
|
||||
uint8_t temp;
|
||||
|
||||
|
475
board/STM8L052R8T6/USER/stm8l15x_it_shell.c
Normal file
475
board/STM8L052R8T6/USER/stm8l15x_it_shell.c
Normal file
@@ -0,0 +1,475 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file USART/USART_HyperTerminal_Interrupts/stm8l15x_it.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.5.2
|
||||
* @date 30-September-2014
|
||||
* @brief Main Interrupt Service Routines.
|
||||
* This file provides template for all peripherals interrupt service routine.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
|
||||
* You may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.st.com/software_license_agreement_liberty_v2
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm8l15x_it.h"
|
||||
|
||||
#include "stm8l15x_usart.h"
|
||||
|
||||
#include "tos_k.h"
|
||||
#include "tos_shell.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
#define TX_BUFFER_SIZE (countof(TxBuffer) - 1)
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
#define countof(a) (sizeof(a) / sizeof(*(a)))
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
uint8_t TxBuffer[] = "\n\rUSART Example: USART-Hyperterminal communication using Interrupt\nEnter your Text\n\r";
|
||||
uint8_t TxCounter = 0;
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
#ifdef _COSMIC_
|
||||
/**
|
||||
* @brief Dummy interrupt routine
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(NonHandledInterrupt, 0)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief TRAP interrupt routine
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER_TRAP(TRAP_IRQHandler)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief FLASH Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(FLASH_IRQHandler, 1)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief DMA1 channel0 and channel1 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(DMA1_CHANNEL0_1_IRQHandler, 2)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief DMA1 channel2 and channel3 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(DMA1_CHANNEL2_3_IRQHandler, 3)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief RTC / CSS_LSE Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(RTC_CSSLSE_IRQHandler, 4)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief External IT PORTE/F and PVD Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTIE_F_PVD_IRQHandler, 5)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PORTB / PORTG Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTIB_G_IRQHandler, 6)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PORTD /PORTH Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTID_H_IRQHandler, 7)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PIN0 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTI0_IRQHandler, 8)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PIN1 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTI1_IRQHandler, 9)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PIN2 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTI2_IRQHandler, 10)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PIN3 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTI3_IRQHandler, 11)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PIN4 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTI4_IRQHandler, 12)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PIN5 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTI5_IRQHandler, 13)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PIN6 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTI6_IRQHandler, 14)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief External IT PIN7 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(EXTI7_IRQHandler, 15)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief LCD /AES Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(LCD_AES_IRQHandler, 16)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief CLK switch/CSS/TIM1 break Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(SWITCH_CSS_BREAK_DAC_IRQHandler, 17)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ADC1/Comparator Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(ADC1_COMP_IRQHandler, 18)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM2 Update/Overflow/Trigger/Break /USART2 TX Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_TRG_BRK_USART2_TX_IRQHandler, 19)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
|
||||
TIM2_ClearITPendingBit(TIM2_IT_Update);
|
||||
|
||||
if (tos_knl_is_running()) {
|
||||
tos_knl_irq_enter();
|
||||
tos_tick_handler();
|
||||
tos_knl_irq_leave();
|
||||
}
|
||||
|
||||
#ifdef USE_STM8L1528_EVAL
|
||||
/* Write one byte to the transmit data register */
|
||||
USART_SendData8(EVAL_COM1, TxBuffer[TxCounter++]);
|
||||
USART_ClearITPendingBit(EVAL_COM1, USART_IT_TC);
|
||||
|
||||
if (TxCounter == TX_BUFFER_SIZE)
|
||||
{
|
||||
/* Disable the USART Transmit Complete interrupt */
|
||||
USART_ITConfig(EVAL_COM1, USART_IT_TC, DISABLE);
|
||||
}
|
||||
#endif /* USE_STM8L1528_EVAL */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Timer2 Capture/Compare / USART2 RX Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(TIM2_CC_USART2_RX_IRQHandler, 20)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
#ifdef USE_STM8L1528_EVAL
|
||||
uint8_t temp;
|
||||
|
||||
/* Read one byte from the receive data register and send it back */
|
||||
temp = (USART_ReceiveData8(EVAL_COM1) & 0x7F);
|
||||
USART_SendData8(EVAL_COM1, temp);
|
||||
#endif /* USE_STM8L1528_EVAL */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Timer3 Update/Overflow/Trigger/Break Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_TRG_BRK_USART3_TX_IRQHandler, 21)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief Timer3 Capture/Compare /USART3 RX Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(TIM3_CC_USART3_RX_IRQHandler, 22)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief TIM1 Update/Overflow/Trigger/Commutation Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_COM_IRQHandler, 23)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief TIM1 Capture/Compare Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(TIM1_CC_IRQHandler, 24)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM4 Update/Overflow/Trigger Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_TRG_IRQHandler, 25)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* @brief SPI1 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(SPI1_IRQHandler, 26)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief USART1 TX / TIM5 Update/Overflow/Trigger/Break Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(USART1_TX_TIM5_UPD_OVF_TRG_BRK_IRQHandler, 27)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
#ifdef USE_STM8L1526_EVAL
|
||||
/* Write one byte to the transmit data register */
|
||||
USART_SendData8(EVAL_COM1, TxBuffer[TxCounter++]);
|
||||
USART_ClearITPendingBit(EVAL_COM1, USART_IT_TC);
|
||||
|
||||
if (TxCounter == TX_BUFFER_SIZE)
|
||||
{
|
||||
/* Disable the USART Transmit Complete interrupt */
|
||||
USART_ITConfig(EVAL_COM1, USART_IT_TC, DISABLE);
|
||||
}
|
||||
#endif /* USE_STM8L1526_EVAL */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief USART1 RX / Timer5 Capture/Compare Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(USART1_RX_TIM5_CC_IRQHandler, 28)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
|
||||
uint8_t data;
|
||||
|
||||
tos_knl_irq_enter();
|
||||
|
||||
if (USART_GetITStatus(USART1, USART_IT_RXNE)) {
|
||||
data = USART_ReceiveData8(USART1);
|
||||
tos_shell_input_byte(data);
|
||||
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
|
||||
}
|
||||
|
||||
tos_knl_irq_leave();
|
||||
|
||||
#ifdef USE_STM8L1526_EVAL
|
||||
uint8_t temp;
|
||||
|
||||
/* Read one byte from the receive data register and send it back */
|
||||
temp = (USART_ReceiveData8(EVAL_COM1) & 0x7F);
|
||||
USART_SendData8(EVAL_COM1, temp);
|
||||
#endif /* USE_STM8L1526_EVAL */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2C1 / SPI2 Interrupt routine.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
INTERRUPT_HANDLER(I2C1_SPI2_IRQHandler, 29)
|
||||
{
|
||||
/* In order to detect unexpected events during development,
|
||||
it is recommended to set a breakpoint on the following instruction.
|
||||
*/
|
||||
}
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
||||
|
@@ -82,7 +82,7 @@ __STATIC__ void shell_cmd_process(void)
|
||||
static char *argv[SHELL_CMD_ARGV_MAX];
|
||||
char *pos = SHELL_CTL->cmd_buffer;
|
||||
|
||||
printf("%s\n", pos);
|
||||
tos_shell_printf("%s\n", SHELL_CTL->cmd_buffer);
|
||||
|
||||
// left strip
|
||||
while (*pos == ' ' || *pos == '\t') {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "tos_shell.h"
|
||||
#include "tos_hal.h"
|
||||
|
||||
#define CMD_LEN_MAX 128
|
||||
#define CMD_LEN_MAX 25
|
||||
char cmd_buf[CMD_LEN_MAX];
|
||||
|
||||
hal_uart_t shell_uart;
|
||||
|
Reference in New Issue
Block a user