Skip to content

Commit e241c8f

Browse files
adustmAlessandroA
authored andcommitted
Add support for the DISCO_F429ZI target
1 parent 9c7064b commit e241c8f

File tree

2 files changed

+42
-13
lines changed

2 files changed

+42
-13
lines changed

source/led.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static const UvisorBoxAclItem acl[] = {
3030
static void my_box_main(const void *);
3131

3232
UVISOR_BOX_NAMESPACE(NULL);
33-
UVISOR_BOX_HEAPSIZE(8192);
33+
UVISOR_BOX_HEAPSIZE(3072);
3434
UVISOR_BOX_MAIN(my_box_main, osPriorityNormal, UVISOR_BOX_STACK_SIZE);
3535
UVISOR_BOX_CONFIG(my_box, acl, UVISOR_BOX_STACK_SIZE, my_box_context);
3636

@@ -64,12 +64,12 @@ static void my_box_main(const void *)
6464
*uvisor_ctx->led = LED_OFF;
6565

6666
/* allocate a box-specific switch handler */
67-
if(!(uvisor_ctx->sw = new InterruptIn(SW2)))
67+
if(!(uvisor_ctx->sw = new InterruptIn(SECURE_SWITCH)))
6868
pc->printf("ERROR: failed to allocate memories for SW1\n");
6969
else
7070
{
7171
/* register handler for switch SW1 */
72-
uvisor_ctx->sw->mode(PullUp);
72+
uvisor_ctx->sw->mode(SECURE_SWITCH_PULL);
7373
uvisor_ctx->sw->fall(my_box_switch_irq);
7474

7575
/* no problem to return here as everything is initialized */

source/main-hw.h

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@
1717
#ifndef __UVISOR_HELLOWORLD_MAIN_HW_H__
1818
#define __UVISOR_HELLOWORLD_MAIN_HW_H__
1919

20-
/* The vector containing the challenge is shared with the push-button ISR, so
21-
* that it can attempt to access it from an IRQ context. */
20+
#if defined(TARGET_K64F)
2221

23-
#define LED_ON false
24-
#define LED_OFF true
25-
26-
#define MAIN_LED LED_BLUE
27-
#define SECURE_LED LED_RED
28-
29-
#define MAIN_BTN SW2
30-
#define MAIN_BTN_PUPD PullUp
22+
#define MAIN_LED LED1
23+
#define SECURE_LED LED2
24+
#define LED_ON false
25+
#define LED_OFF true
26+
#define SECURE_SWITCH SW2
27+
#define SECURE_SWITCH_PULL PullUp
3128

3229
#define MAIN_ACL(acl_list_name) \
3330
static const UvisorBoxAclItem acl_list_name[] = { \
@@ -48,4 +45,36 @@
4845
{SPI0, sizeof(*SPI0), UVISOR_TACLDEF_PERIPH}, \
4946
}
5047

48+
#elif defined(TARGET_DISCO_F429ZI)
49+
50+
#define MAIN_LED LED1
51+
#define SECURE_LED LED2
52+
#define LED_ON true
53+
#define LED_OFF false
54+
#define SECURE_SWITCH USER_BUTTON
55+
#define SECURE_SWITCH_PULL PullDown
56+
57+
#define MAIN_ACL(acl_list_name) \
58+
static const UvisorBoxAclItem acl_list_name[] = { \
59+
{GPIOA, sizeof(*GPIOA), UVISOR_TACLDEF_PERIPH}, \
60+
{GPIOB, sizeof(*GPIOB), UVISOR_TACLDEF_PERIPH}, \
61+
{GPIOC, sizeof(*GPIOC), UVISOR_TACLDEF_PERIPH}, \
62+
{GPIOD, sizeof(*GPIOD), UVISOR_TACLDEF_PERIPH}, \
63+
{GPIOE, sizeof(*GPIOE), UVISOR_TACLDEF_PERIPH}, \
64+
{RTC, sizeof(*RTC), UVISOR_TACLDEF_PERIPH}, \
65+
{TIM5, sizeof(*TIM5), UVISOR_TACLDEF_PERIPH}, \
66+
{USART1, sizeof(*USART1), UVISOR_TACLDEF_PERIPH}, \
67+
{I2C1, sizeof(*I2C1), UVISOR_TACLDEF_PERIPH}, \
68+
{SPI1, sizeof(*SPI1), UVISOR_TACLDEF_PERIPH}, \
69+
{RCC, sizeof(*RCC), UVISOR_TACLDEF_PERIPH}, \
70+
{FLASH, sizeof(*FLASH), UVISOR_TACLDEF_PERIPH}, \
71+
{PWR, sizeof(*PWR), UVISOR_TACLDEF_PERIPH}, \
72+
{EXTI, sizeof(*EXTI), UVISOR_TACLDEF_PERIPH}, \
73+
{GPIOG, sizeof(*GPIOG), UVISOR_TACLDEF_PERIPH}, \
74+
{SYSCFG, sizeof(*SYSCFG), UVISOR_TACLDEF_PERIPH}, \
75+
{(void *) 0x42000000, 0x01000000, UVISOR_TACLDEF_PERIPH}, /* FIXME */ \
76+
}
77+
78+
#endif /* Target-specific settings */
79+
5180
#endif /* __UVISOR_HELLOWORLD_MAIN_HW_H__ */

0 commit comments

Comments
 (0)