Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lwc
/
compare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e1aa1c3c
authored
Jul 15, 2019
by
Sebastian Renner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working towards F7 template
parent
f54cf577
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
73 deletions
+85
-73
templates/f7/Src/main.c
+53
-50
templates/f7/f7.ioc
+23
-22
templates/f7/flash.jlink
+7
-0
templates/f7/middleware.py
+2
-1
No files found.
templates/f7/Src/main.c
View file @
e1aa1c3c
...
...
@@ -80,7 +80,7 @@ PCD_HandleTypeDef hpcd_USB_OTG_FS;
void
SystemClock_Config
(
void
);
static
void
MX_GPIO_Init
(
void
);
static
void
MX_USB_OTG_FS_PCD_Init
(
void
);
static
void
MX_U
ART4
_Init
(
void
);
static
void
MX_U
SART2
_Init
(
void
);
static
void
read_variable_serial
(
unsigned
char
action
);
static
void
write_variable_serial
(
unsigned
char
target
[],
uint32_t
len
);
...
...
@@ -90,8 +90,8 @@ static void read_serial(void *dst, unsigned int len) {
dbg_printf
(
"Reading %d serial bytes
\n
"
,
len
);
#endif
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
while
(
!
LL_USART_IsActiveFlag_RXNE
(
U
ART4
));
buf
[
i
]
=
LL_USART_ReceiveData8
(
U
ART4
);
while
(
!
LL_USART_IsActiveFlag_RXNE
(
U
SART2
));
buf
[
i
]
=
LL_USART_ReceiveData8
(
U
SART2
);
}
#ifdef DEBUG
dbg_printf
(
"done.
\n
"
,
len
);
...
...
@@ -104,8 +104,8 @@ static void write_serial(const void *src, unsigned int len) {
#ifdef DEBUG
dbg_printf
(
"Write to serial: %02x
\n
"
,
buf
[
i
]);
#endif
while
(
!
(
LL_USART_IsActiveFlag_TXE
(
U
ART4
)));
LL_USART_TransmitData8
(
U
ART4
,
buf
[
i
]);
while
(
!
(
LL_USART_IsActiveFlag_TXE
(
U
SART2
)));
LL_USART_TransmitData8
(
U
SART2
,
buf
[
i
]);
#ifdef DEBUG
dbg_printf
(
"Done writing!
\n
"
);
#endif
...
...
@@ -194,7 +194,7 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init
();
MX_USB_OTG_FS_PCD_Init
();
MX_U
ART4
_Init
();
MX_U
SART2
_Init
();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
...
...
@@ -237,9 +237,9 @@ int main(void)
dbg_printf
(
"p: "
);
for
(
int
i
=
0
;
i
<
nplen
;
i
++
)
dbg_printf
(
"%02x"
,
npub
[
i
]);
dbg_printf
(
"
\n
"
);
dbg_printf
(
"k: "
);
for
(
int
i
=
0
;
i
<
klen
;
i
++
)
dbg_printf
(
"%02x"
,
k
[
i
]);
dbg_printf
(
"
\n
"
);
#endif
LL_GPIO_TogglePin
(
GPIOB
,
LL_GPIO_PIN_14
);
//
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_14);
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
LL_GPIO_TogglePin
(
GPIOB
,
LL_GPIO_PIN_14
);
//
LL_GPIO_TogglePin(GPIOB, LL_GPIO_PIN_14);
break
;
default:
...
...
@@ -249,7 +249,6 @@ int main(void)
/* USER CODE END WHILE */
}
}
/**
* @brief System Clock Configuration
* @retval None
...
...
@@ -295,53 +294,53 @@ void SystemClock_Config(void)
LL_SYSTICK_SetClkSource
(
LL_SYSTICK_CLKSOURCE_HCLK
);
LL_SetSystemCoreClock
(
72000000
);
LL_RCC_SetUSBClockSource
(
LL_RCC_USB_CLKSOURCE_PLL
);
LL_RCC_SetU
ARTClockSource
(
LL_RCC_UART4
_CLKSOURCE_PCLK1
);
LL_RCC_SetU
SARTClockSource
(
LL_RCC_USART2
_CLKSOURCE_PCLK1
);
}
/**
* @brief U
ART4
Initialization Function
* @brief U
SART2
Initialization Function
* @param None
* @retval None
*/
static
void
MX_U
ART4
_Init
(
void
)
static
void
MX_U
SART2
_Init
(
void
)
{
/* USER CODE BEGIN U
ART4
_Init 0 */
/* USER CODE BEGIN U
SART2
_Init 0 */
/* USER CODE END U
ART4
_Init 0 */
/* USER CODE END U
SART2
_Init 0 */
LL_USART_InitTypeDef
USART_InitStruct
=
{
0
};
LL_GPIO_InitTypeDef
GPIO_InitStruct
=
{
0
};
/* Peripheral clock enable */
LL_APB1_GRP1_EnableClock
(
LL_APB1_GRP1_PERIPH_U
ART4
);
LL_APB1_GRP1_EnableClock
(
LL_APB1_GRP1_PERIPH_U
SART2
);
LL_AHB1_GRP1_EnableClock
(
LL_AHB1_GRP1_PERIPH_GPIOA
);
LL_AHB1_GRP1_EnableClock
(
LL_AHB1_GRP1_PERIPH_GPIO
C
);
/**U
ART4
GPIO Configuration
PA
0/WKUP ------> UART4_T
X
P
C11 ------> UART4_R
X
LL_AHB1_GRP1_EnableClock
(
LL_AHB1_GRP1_PERIPH_GPIO
D
);
/**U
SART2
GPIO Configuration
PA
3 ------> USART2_R
X
P
D5 ------> USART2_T
X
*/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_
0
;
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_
3
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ALTERNATE
;
GPIO_InitStruct
.
Speed
=
LL_GPIO_SPEED_FREQ_VERY_HIGH
;
GPIO_InitStruct
.
OutputType
=
LL_GPIO_OUTPUT_PUSHPULL
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
GPIO_InitStruct
.
Alternate
=
LL_GPIO_AF_
8
;
GPIO_InitStruct
.
Alternate
=
LL_GPIO_AF_
7
;
LL_GPIO_Init
(
GPIOA
,
&
GPIO_InitStruct
);
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_
11
;
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_
5
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ALTERNATE
;
GPIO_InitStruct
.
Speed
=
LL_GPIO_SPEED_FREQ_VERY_HIGH
;
GPIO_InitStruct
.
OutputType
=
LL_GPIO_OUTPUT_PUSHPULL
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
GPIO_InitStruct
.
Alternate
=
LL_GPIO_AF_
8
;
LL_GPIO_Init
(
GPIO
C
,
&
GPIO_InitStruct
);
GPIO_InitStruct
.
Alternate
=
LL_GPIO_AF_
7
;
LL_GPIO_Init
(
GPIO
D
,
&
GPIO_InitStruct
);
/* USER CODE BEGIN U
ART4
_Init 1 */
/* USER CODE BEGIN U
SART2
_Init 1 */
/* USER CODE END U
ART4
_Init 1 */
/* USER CODE END U
SART2
_Init 1 */
USART_InitStruct
.
BaudRate
=
115200
;
USART_InitStruct
.
DataWidth
=
LL_USART_DATAWIDTH_8B
;
USART_InitStruct
.
StopBits
=
LL_USART_STOPBITS_1
;
...
...
@@ -349,12 +348,12 @@ static void MX_UART4_Init(void)
USART_InitStruct
.
TransferDirection
=
LL_USART_DIRECTION_TX_RX
;
USART_InitStruct
.
HardwareFlowControl
=
LL_USART_HWCONTROL_NONE
;
USART_InitStruct
.
OverSampling
=
LL_USART_OVERSAMPLING_16
;
LL_USART_Init
(
U
ART4
,
&
USART_InitStruct
);
LL_USART_ConfigAsyncMode
(
U
ART4
);
LL_USART_Enable
(
U
ART4
);
/* USER CODE BEGIN U
ART4
_Init 2 */
LL_USART_Init
(
U
SART2
,
&
USART_InitStruct
);
LL_USART_ConfigAsyncMode
(
U
SART2
);
LL_USART_Enable
(
U
SART2
);
/* USER CODE BEGIN U
SART2
_Init 2 */
/* USER CODE END U
ART4
_Init 2 */
/* USER CODE END U
SART2
_Init 2 */
}
...
...
@@ -549,6 +548,12 @@ static void MX_GPIO_Init(void)
LL_GPIO_Init
(
GPIOC
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_0
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
LL_GPIO_Init
(
GPIOA
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
RMII_REF_CLK_Pin
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ALTERNATE
;
GPIO_InitStruct
.
Speed
=
LL_GPIO_SPEED_FREQ_VERY_HIGH
;
...
...
@@ -567,12 +572,6 @@ static void MX_GPIO_Init(void)
LL_GPIO_Init
(
RMII_MDIO_GPIO_Port
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_3
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
LL_GPIO_Init
(
GPIOA
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_4
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
...
...
@@ -657,8 +656,8 @@ static void MX_GPIO_Init(void)
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_14
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_OUTPUT
;
GPIO_InitStruct
.
OutputType
=
LL_GPIO_OUTPUT_PUSHPULL
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
LL_GPIO_Init
(
GPIOF
,
&
GPIO_InitStruct
);
/**/
...
...
@@ -723,9 +722,9 @@ static void MX_GPIO_Init(void)
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_14
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_OUTPUT
;
GPIO_InitStruct
.
OutputType
=
LL_GPIO_OUTPUT_PUSHPULL
;
LL_GPIO_Init
(
GPIO
F
,
&
GPIO_InitStruct
);
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
LL_GPIO_Init
(
GPIO
E
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_15
;
...
...
@@ -820,7 +819,7 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_14
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
LL_GPIO_Init
(
GPIO
E
,
&
GPIO_InitStruct
);
LL_GPIO_Init
(
GPIO
D
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_15
;
...
...
@@ -904,6 +903,15 @@ static void MX_GPIO_Init(void)
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_10
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ALTERNATE
;
GPIO_InitStruct
.
Speed
=
LL_GPIO_SPEED_FREQ_VERY_HIGH
;
GPIO_InitStruct
.
OutputType
=
LL_GPIO_OUTPUT_PUSHPULL
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
GPIO_InitStruct
.
Alternate
=
LL_GPIO_AF_8
;
LL_GPIO_Init
(
GPIOC
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_11
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
LL_GPIO_Init
(
GPIOC
,
&
GPIO_InitStruct
);
...
...
@@ -945,12 +953,6 @@ static void MX_GPIO_Init(void)
LL_GPIO_Init
(
GPIOD
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_5
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
LL_GPIO_Init
(
GPIOD
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_6
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
...
...
@@ -1002,7 +1004,7 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_14
;
GPIO_InitStruct
.
Mode
=
LL_GPIO_MODE_ANALOG
;
GPIO_InitStruct
.
Pull
=
LL_GPIO_PULL_NO
;
LL_GPIO_Init
(
GPIO
D
,
&
GPIO_InitStruct
);
LL_GPIO_Init
(
GPIO
G
,
&
GPIO_InitStruct
);
/**/
GPIO_InitStruct
.
Pin
=
LL_GPIO_PIN_15
;
...
...
@@ -1112,3 +1114,4 @@ void assert_failed(uint8_t *file, uint32_t line)
#endif
/* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
templates/f7/f7.ioc
View file @
e1aa1c3c
...
...
@@ -13,23 +13,23 @@ Mcu.Name=STM32F746ZGTx
Mcu.Package=LQFP144
Mcu.Pin0=PC13
Mcu.Pin1=PC14/OSC32_IN
Mcu.Pin10=PC
4
Mcu.Pin11=P
C5
Mcu.Pin12=PB
0
Mcu.Pin13=PB1
3
Mcu.Pin14=P
B14
Mcu.Pin15=PD
8
Mcu.Pin16=P
D9
Mcu.Pin17=PG
6
Mcu.Pin18=P
G7
Mcu.Pin19=PA
8
Mcu.Pin10=PC
5
Mcu.Pin11=P
B0
Mcu.Pin12=PB
13
Mcu.Pin13=PB1
4
Mcu.Pin14=P
D8
Mcu.Pin15=PD
9
Mcu.Pin16=P
G6
Mcu.Pin17=PG
7
Mcu.Pin18=P
A8
Mcu.Pin19=PA
9
Mcu.Pin2=PC15/OSC32_OUT
Mcu.Pin20=PA
9
Mcu.Pin21=PA1
0
Mcu.Pin22=PA1
1
Mcu.Pin23=PA1
2
Mcu.Pin24=PA1
3
Mcu.Pin25=P
A14
Mcu.Pin20=PA
10
Mcu.Pin21=PA1
1
Mcu.Pin22=PA1
2
Mcu.Pin23=PA1
3
Mcu.Pin24=PA1
4
Mcu.Pin25=P
C10
Mcu.Pin26=PC11
Mcu.Pin27=PG11
Mcu.Pin28=PG13
...
...
@@ -39,10 +39,10 @@ Mcu.Pin30=PB7
Mcu.Pin31=VP_SYS_VS_Systick
Mcu.Pin4=PH1/OSC_OUT
Mcu.Pin5=PC1
Mcu.Pin6=PA
0/WKUP
Mcu.Pin7=PA
1
Mcu.Pin8=PA
2
Mcu.Pin9=P
A7
Mcu.Pin6=PA
1
Mcu.Pin7=PA
2
Mcu.Pin8=PA
7
Mcu.Pin9=P
C4
Mcu.PinsNb=32
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
...
...
@@ -59,8 +59,6 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:true\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false
PA0/WKUP.Mode=Asynchronous
PA0/WKUP.Signal=UART4_TX
PA1.GPIOParameters=GPIO_Label
PA1.GPIO_Label=RMII_REF_CLK [LAN8742A-CZ-TR_REFCLK0]
PA1.Locked=true
...
...
@@ -131,6 +129,9 @@ PC1.GPIOParameters=GPIO_Label
PC1.GPIO_Label=RMII_MDC [LAN8742A-CZ-TR_MDC]
PC1.Locked=true
PC1.Signal=ETH_MDC
PC10.Locked=true
PC10.Mode=Asynchronous
PC10.Signal=UART4_TX
PC11.Mode=Asynchronous
PC11.Signal=UART4_RX
PC13.GPIOParameters=GPIO_Label
...
...
templates/f7/flash.jlink
0 → 100644
View file @
e1aa1c3c
if SWD
speed 4000
device STM32F746ZG
loadbin build/f7.bin 0x8000000
r
g
exit
templates/f7/middleware.py
View file @
e1aa1c3c
...
...
@@ -14,7 +14,8 @@ ser = serial.Serial('/dev/ttyUSB0', 115200)
def
flash
():
pipe
=
subprocess
.
PIPE
p
=
subprocess
.
Popen
([
'stm32flash'
,
'build/f7.bin'
,
'0x8000000'
],
stdout
=
sys
.
stderr
,
stdin
=
pipe
)
p
=
subprocess
.
Popen
([
'JLinkExe'
,
'flash.jlink'
],
stdout
=
sys
.
stderr
,
stdin
=
pipe
)
#p = subprocess.Popen(['stm32flash', 'build/f7.bin', '0x8000000'], stdout=sys.stderr, stdin=pipe)
stdout
,
stderr
=
p
.
communicate
(
""
)
def
read
(
channel
,
l
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment