-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rafael Silva <[email protected]>
- Loading branch information
Showing
2 changed files
with
215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
CFLAGS += \ | ||
-flto \ | ||
-mthumb \ | ||
-mcpu=cortex-m4 \ | ||
-mfloat-abi=hard \ | ||
-mfpu=fpv4-sp-d16 \ | ||
-nostdlib -nostartfiles \ | ||
-D__START=main \ | ||
-DEFM32GG12B810F1024GM64 \ | ||
-DCFG_TUSB_MCU=OPT_MCU_EFM32GG12 | ||
|
||
# mcu driver cause following warnings | ||
#CFLAGS += -Wno-error=unused-parameter | ||
|
||
SILABS_FAMILY = efm32gg12b | ||
SILABS_FAMILY_ = EFM32GG12B | ||
SILABS_CMSIS = hw/mcu/silabs/cmsis-dfp-$(SILABS_FAMILY)/Device/SiliconLabs/$(SILABS_FAMILY_) | ||
|
||
# All source paths should be relative to the top level. | ||
LD_FILE = $(SILABS_CMSIS)/Source/GCC/$(SILABS_FAMILY).ld | ||
|
||
SRC_C += \ | ||
$(SILABS_CMSIS)/Source/system_$(SILABS_FAMILY).c \ | ||
|
||
SRC_S += \ | ||
$(SILABS_CMSIS)/Source/GCC/startup_$(SILABS_FAMILY).S | ||
|
||
INC += \ | ||
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \ | ||
$(TOP)/$(SILABS_CMSIS)/Include \ | ||
$(TOP)/hw/bsp/$(BOARD) | ||
|
||
# For TinyUSB port source | ||
VENDOR = silabs | ||
CHIP_FAMILY = efm32gg | ||
|
||
# For freeRTOS port source | ||
FREERTOS_PORT = ARM_CM4 | ||
|
||
# For flash-jlink target | ||
JLINK_DEVICE = EFM32GG12B810F1024 | ||
|
||
# flash target ROM bootloader | ||
flash: $(BUILD)/$(BOARD)-firmware.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2019 Ha Thach (tinyusb.org) | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* This file is part of the TinyUSB stack. | ||
*/ | ||
|
||
#include "../board.h" | ||
#include "em_device.h" | ||
|
||
//--------------------------------------------------------------------+ | ||
// Forward USB interrupt events to TinyUSB IRQ Handler | ||
//--------------------------------------------------------------------+ | ||
void USB_IRQHandler(void) | ||
{ | ||
tud_int_handler(0); | ||
} | ||
|
||
//--------------------------------------------------------------------+ | ||
// MACRO TYPEDEF CONSTANT ENUM | ||
//--------------------------------------------------------------------+ | ||
#define LED_PORT 0 | ||
#define LED_PIN 0 | ||
#define LED_STATE_ON 1 | ||
|
||
#define BUTTON_PORT 0 | ||
#define BUTTON_PIN 0 | ||
#define BUTTON_STATE_ACTIVE 0 | ||
|
||
|
||
/** | ||
* @brief System Clock Configuration | ||
* The system Clock is configured as follow : | ||
* System Clock source = PLL (HSE) | ||
* SYSCLK(Hz) = 72000000 | ||
* HCLK(Hz) = 72000000 | ||
* AHB Prescaler = 1 | ||
* APB1 Prescaler = 2 | ||
* APB2 Prescaler = 1 | ||
* HSE Frequency(Hz) = 8000000 | ||
* HSE PREDIV1 = 1 | ||
* PLLMUL = 9 | ||
* Flash Latency(WS) = 2 | ||
* @param None | ||
* @retval None | ||
*/ | ||
void SystemClock_Config(void) | ||
{ | ||
|
||
} | ||
|
||
void board_init(void) | ||
{ | ||
SystemClock_Config(); | ||
|
||
#if CFG_TUSB_OS == OPT_OS_NONE | ||
// 1ms tick timer | ||
//SysTick_Config(SystemCoreClock / 1000); | ||
#endif | ||
|
||
// LED | ||
|
||
// Button | ||
|
||
// USB Pins | ||
// Configure USB DM and DP pins. | ||
|
||
// USB Clock enable | ||
} | ||
|
||
//--------------------------------------------------------------------+ | ||
// Board porting API | ||
//--------------------------------------------------------------------+ | ||
|
||
void board_led_write(bool state) | ||
{ | ||
(void)state; | ||
} | ||
|
||
uint32_t board_button_read(void) | ||
{ | ||
return 0; | ||
} | ||
|
||
int board_uart_read(uint8_t* buf, int len) | ||
{ | ||
(void) buf; (void) len; | ||
return 0; | ||
} | ||
|
||
int board_uart_write(void const * buf, int len) | ||
{ | ||
(void) buf; (void) len; | ||
return 0; | ||
} | ||
|
||
#if CFG_TUSB_OS == OPT_OS_NONE | ||
volatile uint32_t system_ticks = 0; | ||
void SysTick_Handler(void) | ||
{ | ||
system_ticks++; | ||
} | ||
|
||
uint32_t board_millis(void) | ||
{ | ||
return system_ticks; | ||
} | ||
#endif | ||
|
||
void HardFault_Handler(void) | ||
{ | ||
asm("bkpt"); | ||
} | ||
|
||
void MemManage_Handler(void) | ||
{ | ||
asm("bkpt"); | ||
} | ||
|
||
void BusFault_Handler(void) | ||
{ | ||
asm("bkpt"); | ||
} | ||
|
||
void UsageFault_Handler(void) | ||
{ | ||
asm("bkpt"); | ||
} | ||
|
||
#ifdef USE_FULL_ASSERT | ||
/** | ||
* @brief Reports the name of the source file and the source line number | ||
* where the assert_param error has occurred. | ||
* @param file: pointer to the source file name | ||
* @param line: assert_param error line source number | ||
* @retval None | ||
*/ | ||
void assert_failed(char *file, uint32_t line) | ||
{ | ||
/* USER CODE BEGIN 6 */ | ||
/* User can add his own implementation to report the file name and line number, | ||
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ | ||
/* USER CODE END 6 */ | ||
} | ||
#endif /* USE_FULL_ASSERT */ | ||
|
||
// Required by __libc_init_array in startup code if we are compiling using | ||
// -nostdlib/-nostartfiles. | ||
void _init(void) | ||
{ | ||
|
||
} |