Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Netduino plus 2 functional
Browse files Browse the repository at this point in the history
  • Loading branch information
ilg-ul committed Dec 26, 2016
1 parent f4da4ec commit a8e3e02
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 26 deletions.
50 changes: 45 additions & 5 deletions hw/cortexm/stm32/boards-duino.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <hw/cortexm/board.h>
#include <hw/cortexm/stm32/mcus.h>
#include <hw/cortexm/gpio-led.h>
#include <hw/cortexm/button-gpio.h>
#include <hw/cortexm/button-reset.h>
#include <hw/cortexm/helper.h>

/*
Expand Down Expand Up @@ -49,26 +51,57 @@ static void netduino2_board_init_callback(MachineState *machine)

static GPIOLEDInfo netduinoplus2_leds_info[] = {
{
.name = "blue-led",
.name = "led:blue",
.active_low = false,
.colour_name = "blue",
.x = 507,
.y = 183,
.w = 12,
.h = 14,
.gpio_path = "/machine/mcu/stm32/gpio[a]",

.gpio_path = DEVICE_PATH_STM32_GPIO_A,
.irq_name = STM32_IRQ_GPIO_ODR_OUT,
.gpio_bit = 10,
/**/
},
{ },
/**/
};

static ButtonGPIOInfo netduinoplus2_buttons_user_info[] = {
{
.name = "button:user",
.x = 477,
.y = 299,
.w = 28,
.h = 28,

.active_low = false,
.gpio_path = DEVICE_PATH_STM32_GPIO_C,
.irq_name = STM32_IRQ_GPIO_IDR_IN,
.gpio_bit = 14,
/**/
},
{ },
/**/
};

// Button not physically present, only as a pin in a connector.
static ButtonResetInfo netduinoplus2_button_reset_info = {
.x = 305,
.y = 452,
.w = 15,
.h = 45,
/**/
};

static void netduinoplus2_board_init_callback(MachineState *machine)
{
CortexMBoardState *board = CORTEXM_BOARD_STATE(machine);

cortexm_board_greeting(board);
BoardGraphicContext *board_graphic_context =
cortexm_board_init_graphic_image(board, "NetduinoPlus2.jpg");

{
// Create the MCU
Expand All @@ -81,11 +114,18 @@ static void netduinoplus2_board_init_callback(MachineState *machine)
cm_object_realize(mcu);
}

cortexm_board_init_graphic_image(board, "NetduinoPlus2.jpg");

Object *peripheral = cm_container_get_peripheral();
// Create board LEDs.
gpio_led_create_from_info(peripheral, netduinoplus2_leds_info,
&(board->graphic_context));
board_graphic_context);

if (board_graphic_context != NULL) {
// Create board buttons.
button_reset_create_from_info(peripheral,
&netduinoplus2_button_reset_info, board_graphic_context);
button_gpio_create_from_info(peripheral,
netduinoplus2_buttons_user_info, board_graphic_context);
}
}

static void netduinoplus2_board_class_init_callback(ObjectClass *oc, void *data)
Expand Down
1 change: 1 addition & 0 deletions hw/cortexm/stm32/boards-nucleo.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ static GPIOLEDInfo nucleo_f411re_leds_info[] = {
.y = 307,
.w = 8,
.h = 6,

.gpio_path = DEVICE_PATH_STM32_GPIO_A,
.irq_name = STM32_IRQ_GPIO_ODR_OUT,
.gpio_bit = 5,
Expand Down
3 changes: 2 additions & 1 deletion hw/cortexm/stm32/exti.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,8 @@ static void stm32f107xx_exti_create_objects(Object *obj, JSON_Object *svd,
}

// ----------------------------------------------------------------------------
// STM32F407VG, STM32F407ZG

// STM32F407VG, STM32F407ZG, STM32F405RG
// DO NOT EDIT! Automatically generated!
static void stm32f40x_exti_create_objects(Object *obj, JSON_Object *svd,
const char *name)
Expand Down
2 changes: 1 addition & 1 deletion hw/cortexm/stm32/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static void stm32f107xx_flash_create_objects(Object *obj, JSON_Object *svd,

// ----------------------------------------------------------------------------

// STM32F407VG, STM32F407ZG
// STM32F407VG, STM32F407ZG, STM32F405RG
// DO NOT EDIT! Automatically generated!
static void stm32f40x_flash_create_objects(Object *obj, JSON_Object *svd,
const char *name)
Expand Down
2 changes: 1 addition & 1 deletion hw/cortexm/stm32/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ static void stm32f107xx_gpio_create_objects(Object *obj, JSON_Object *svd,

// ----------------------------------------------------------------------------

// STM32F407VG, STM32F407ZG
// STM32F407VG, STM32F407ZG, STM32F405RG
// DO NOT EDIT! Automatically generated!
static void stm32f40x_gpio_create_objects(Object *obj, JSON_Object *svd,
const char *name)
Expand Down
33 changes: 19 additions & 14 deletions hw/cortexm/stm32/mcus.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,20 +385,30 @@ static const STM32Capabilities stm32l15_12_xd = {
};
#endif

#if 0
static const STM32Capabilities stm32f405xx = {

.family = STM32_FAMILY_F4,
.f4 = {
.is_01_57_xx = true},
.is_40x = true
/**/
},

.hsi_freq_hz = 16000000,
.lsi_freq_hz = 32000,

.has_periph_bitband = true,

#if 0
.has_rcc = true,
.has_pwr = true,
.has_exti = true,
.has_syscfg = true,
#endif

.num_exti = 23,

.has_rtc = true,
.num_back_bytes = 80,
.has_periph_bitband = true,

.ccm_size_kb = 64,
.back_sram_size_kb = 4,
Expand All @@ -409,9 +419,6 @@ static const STM32Capabilities stm32f405xx = {
.has_dma2 = true,
.num_dma2 = 8,
.has_fsmc = true,
.has_exti = true,
.num_exti = 23,
.has_syscfg = true,

.has_ac_tim1 = true,
.has_ac_tim8 = true,
Expand Down Expand Up @@ -470,9 +477,8 @@ static const STM32Capabilities stm32f405xx = {

.has_dac1 = true, /* 12-bits */
.has_dac2 = true,
/**/
/**/
};
#endif

static const STM32Capabilities stm32f407xx = {

Expand Down Expand Up @@ -909,19 +915,18 @@ static const STM32PartInfo stm32_mcus[] = {
/**/
},
#endif
#if 0
{
.name = TYPE_STM32F405RG,
.cortexm = {
.flash_size_kb = 1024,
.sram_size_kb = 128, /* 64K CCM not counted */
.core = &stm32f4_01_57_xx_core, /* TODO: Add .stm32 */
/**/
},

.svd_file_name = "STM32F40x-qemu.json",
.svd_device_name = "STM32F40x",
/**/},
.stm32 = &stm32f405xx,
/**/
/**/
},
#endif
{
.name = TYPE_STM32F407VG,
.cortexm = {
Expand Down
2 changes: 1 addition & 1 deletion hw/cortexm/stm32/pwr.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void stm32f107xx_pwr_create_objects(Object *obj, JSON_Object *svd,

// ----------------------------------------------------------------------------

// STM32F407VG, STM32F407ZG
// STM32F407VG, STM32F407ZG, STM32F405RG
// DO NOT EDIT! Automatically generated!
static void stm32f40x_pwr_create_objects(Object *obj, JSON_Object *svd,
const char *name)
Expand Down
2 changes: 1 addition & 1 deletion hw/cortexm/stm32/rcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ static void stm32f107xx_rcc_create_objects(Object *obj, JSON_Object *svd,

// ----------------------------------------------------------------------------

// STM32F407VG, STM32F407ZG
// STM32F407VG, STM32F407ZG, STM32F405RG
// DO NOT EDIT! Automatically generated!
static void stm32f40x_rcc_create_objects(Object *obj, JSON_Object *svd,
const char *name)
Expand Down
2 changes: 1 addition & 1 deletion hw/cortexm/stm32/syscfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static void stm32f0x1_syscfg_create_objects(Object *obj, JSON_Object *svd,

// ----------------------------------------------------------------------------

// STM32F407VG, STM32F407ZG
// STM32F407VG, STM32F407ZG, STM32F405RG
// DO NOT EDIT! Automatically generated!
static void stm32f40x_syscfg_create_objects(Object *obj, JSON_Object *svd,
const char *name)
Expand Down
2 changes: 1 addition & 1 deletion hw/cortexm/stm32/usart.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ static void stm32f107xx_usart_create_objects(Object *obj, JSON_Object *svd,

// ----------------------------------------------------------------------------

// STM32F407VG, STM32F407ZG
// STM32F407VG, STM32F407ZG, STM32F405RG
// DO NOT EDIT! Automatically generated!
static void stm32f40x_usart_create_objects(Object *obj, JSON_Object *svd,
const char *name)
Expand Down

0 comments on commit a8e3e02

Please sign in to comment.