Sync with reference boards on nf-interpreter repository

Signed-off-by: Peter Wessel <piwi1263@gmail.com>
This commit is contained in:
Peter Wessel 2017-04-04 01:31:42 +02:00
Родитель 6b34977f63
Коммит c9ba45e873
12 изменённых файлов: 57 добавлений и 111 удалений

Просмотреть файл

@ -3,7 +3,7 @@
# See LICENSE file in the project root for full license information.
#
# append source files required for ChibiOS interface
# append common source files
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_HAL_Interface.c")
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/usbcfg.c")
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Device_BlockStorage.c")

Просмотреть файл

@ -20,7 +20,7 @@ const BlockRange BlockRange2[] =
const BlockRange BlockRange3[] =
{
{ BlockRange_BLOCKTYPE_CODE , 0, 0 }, // 08020000 nanoCLR
{ BlockRange_BLOCKTYPE_DEPLOYMENT, 1, 6 } // 08040000 deployment
{ BlockRange_BLOCKTYPE_DEPLOYMENT, 1, 5 } // 08030000 deployment
};
const BlockRegionInfo BlockRegions[] =

Просмотреть файл

@ -10,7 +10,6 @@
extern const USBConfig usbcfg;
extern SerialUSBConfig serusbcfg;
extern SerialUSBDriver SDU1;
extern SerialDriver SD6;
#endif /* _USBCFG_H_ */

Просмотреть файл

@ -12,12 +12,6 @@
#include <WireProtocol_ReceiverThread.h>
#include <LaunchCLR.h>
// For printf experiment only
//#include <chprintf.h>
//#include <chstreams.h>
//#include <string.h>
//#include <stdio.h>
void BlinkerThread(void const * argument)
{
(void)argument;
@ -25,18 +19,6 @@ void BlinkerThread(void const * argument)
// loop until thread receives a request to terminate
while (!chThdShouldTerminateX()) {
//palSetPad(GPIOD, GPIOD_LED3);
//osDelay(250);
//palClearPad(GPIOD, GPIOD_LED3);
//palSetPad(GPIOD, GPIOD_LED5);
//osDelay(250);
//palClearPad(GPIOD, GPIOD_LED5);
//palSetPad(GPIOD, GPIOD_LED6);
//osDelay(250);
//palClearPad(GPIOD, GPIOD_LED6);
palSetPad(GPIOA, GPIOA_LED_GREEN);
osDelay(250);
@ -61,28 +43,20 @@ int main(void) {
// and performs the board-specific initializations.
halInit();
//chSysInit();
// the following IF is not mandatory, it's just providing a way for a user to 'force'
// the board to remain in nanoBooter and not launching nanoCLR
sdStart(&SD6, NULL);
palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(8));
palSetPadMode(GPIOC, 7, PAL_MODE_ALTERNATE(8));
//chprintf((BaseSequentialStream*)&SD6, "\r\nPeter was here !!!!!\r\n\n");
//chprintf((BaseSequentialStream*)&SD6, "The color . . . . %s\r\n", "orange");
//chprintf((BaseSequentialStream*)&SD6, "First number . . . %d\r\n", 12345);
//chprintf((BaseSequentialStream*)&SD6, "Second number . . . %04d\r\n", 25);
//chprintf((BaseSequentialStream*)&SD6, "Third number . . . %i\r\n", 1234);
//chprintf((BaseSequentialStream*)&SD6, "Float number . . . %3.2f\r\n", 3.14159);
//chprintf((BaseSequentialStream*)&SD6, "Hexadecimal . . . . %x\r\n", 255);
//chprintf((BaseSequentialStream*)&SD6, "Octal . . . . . . . %o\r\n", 255);
//chprintf((BaseSequentialStream*)&SD6, "Unsigned value . . %u\r\n", 150);
char data[100];
float myFloat = 3.14159;
//sprintf(data, "Float : %f", myFloat);
streamWrite(&SD6, (uint8_t *) data, strlen(data));
// if the USER button (blue one) is pressed, skip the check for a valid CLR image and remain in booter
if (palReadPad(GPIOC, GPIOC_BUTTON))
{
// check for valid CLR image
if(CheckValidCLRImage((uint32_t)&__nanoImage_end__))
{
// there seems to be a valid CLR image
// launch nanoCLR
LaunchCLR((uint32_t)&__nanoImage_end__);
}
}
// The kernel is initialized but not started yet, this means that
// main() is executing with absolute priority but interrupts are already enabled.
@ -108,31 +82,9 @@ int main(void) {
// start kernel, after this the main() thread has priority osPriorityNormal by default
osKernelStart();
// Some feedback
// debug_printf("Booter started, press button ...");
// Normal main() thread
while (true) {
// check for button pressed
if (!palReadPad(GPIOC, GPIOC_BUTTON))
{
// Some feedback
// debug_printf("Button pressed ...");
// Start the shutdown sequence
// terminate threads
osThreadTerminate(receiverThreadId);
osThreadTerminate(blinkerThreadId);
// stop the serial-over-USB CDC driver
sduStop(&SDU1);
// launch nanoCLR
LaunchCLR(0x08008000);
}
osDelay(500);
}
}

Просмотреть файл

@ -244,7 +244,7 @@
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
#define STM32_SERIAL_USE_USART6 TRUE
#define STM32_SERIAL_USE_USART6 FALSE
#define STM32_SERIAL_USART1_PRIORITY 12
#define STM32_SERIAL_USART2_PRIORITY 12
#define STM32_SERIAL_USART3_PRIORITY 12

Просмотреть файл

@ -5,5 +5,6 @@
# # append nanoBooter source files
list(APPEND NANOCLR_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.c")
# make var global
set(NANOCLR_PROJECT_SOURCES ${NANOCLR_PROJECT_SOURCES} CACHE INTERNAL "make global")

Просмотреть файл

@ -12,9 +12,9 @@
*/
MEMORY
{
flash : org = 0x08008000, len = 512k - 32k - 800k /* flash size less the space reserved for nanoBooter and application deployment*/
deployment : org = 0x08040000, len = 800k /* space reserved for application deployment */
ramvt : org = 0x20000000, len = 0xC0 /* initial RAM address is reserved for a copy of the vector table */
flash : org = 0x08008000, len = 512k - 32k - 320k /* flash size less the space reserved for nanoBooter and application deployment*/
deployment : org = 0x08030000, len = 320k /* space reserved for application deployment */
ramvt : org = 0x20000000, len = 0 /* initial RAM address is reserved for a copy of the vector table */
ram0 : org = 0x20000000, len = 128k /* SRAM1 */
ram1 : org = 0x00000000, len = 0
ram2 : org = 0x00000000, len = 0

Просмотреть файл

@ -18,13 +18,6 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// address of vector table for nanoCLR
#define CORTEX_VTOR_INIT 0x08008000U
///////////////////////////////////////////////////////////////////////////////
#define CORTEX_USE_FPU TRUE
/*===========================================================================*/
/**
* @name System timers settings
@ -43,7 +36,7 @@
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
*/
#define CH_CFG_ST_FREQUENCY 1000
#define CH_CFG_ST_FREQUENCY 1000 // this is 1 millisecond
/**
* @brief Time delta constant for the tick-less mode.
@ -491,6 +484,11 @@
/* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/
///////////////////////////////////////////////////////////////////////////////
// address of vector table for nanoCLR
#define CORTEX_VTOR_INIT 0x08008000U
///////////////////////////////////////////////////////////////////////////////
#endif /* _CHCONF_H_ */
/** @} */

Просмотреть файл

@ -8,45 +8,21 @@
#include <cmsis_os.h>
#include "usbcfg.h"
#include <CLR_Startup_Thread.h>
#include <WireProtocol_ReceiverThread.h>
void BlinkerThread(void const * argument)
{
(void)argument;
//palSetPad(GPIOD, GPIOD_LED3);
//palSetPad(GPIOD, GPIOD_LED4);
//palSetPad(GPIOD, GPIOD_LED5);
//palSetPad(GPIOD, GPIOD_LED6);
palSetPad(GPIOA, GPIOA_LED_GREEN);
osDelay(1000);
//palClearPad(GPIOD, GPIOD_LED3);
//palClearPad(GPIOD, GPIOD_LED4);
//palClearPad(GPIOD, GPIOD_LED5);
//palClearPad(GPIOD, GPIOD_LED6);
palClearPad(GPIOA, GPIOA_LED_GREEN);
osDelay(250);
while (true) {
//palSetPad(GPIOD, GPIOD_LED3);
//osDelay(125);
//palClearPad(GPIOD, GPIOD_LED3);
//palSetPad(GPIOD, GPIOD_LED4);
//osDelay(125);
//palClearPad(GPIOD, GPIOD_LED4);
//palSetPad(GPIOD, GPIOD_LED6);
//osDelay(125);
//palClearPad(GPIOD, GPIOD_LED6);
//palSetPad(GPIOD, GPIOD_LED5);
//osDelay(125);
//palClearPad(GPIOD, GPIOD_LED5);
palSetPad(GPIOA, GPIOA_LED_GREEN);
osDelay(125);
@ -59,6 +35,9 @@ osThreadDef(BlinkerThread, osPriorityNormal, 128);
// need to declare the Receiver thread here
osThreadDef(ReceiverThread, osPriorityNormal, 1024);
// declare CLRStartup thread here
osThreadDef(CLRStartupThread, osPriorityNormal, 1024);
// Application entry point.
int main(void) {
@ -86,6 +65,9 @@ int main(void) {
// create the receiver thread
osThreadCreate(osThread(ReceiverThread), NULL);
// create the CLR Startup thread
osThreadCreate(osThread(CLRStartupThread), NULL);
// start kernel, after this the main() thread has priority osPriorityNormal by default
osKernelStart();
@ -95,4 +77,3 @@ int main(void) {
osDelay(1000);
}
}

Просмотреть файл

@ -26,24 +26,26 @@
/*
* HAL driver system settings.
*/
#define STM32_NO_INIT FALSE
#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSE_ENABLED FALSE
#define STM32_HSI_ENABLED FALSE
#define STM32_LSI_ENABLED FALSE
#define STM32_HSE_ENABLED TRUE
#define STM32_LSE_ENABLED TRUE
#define STM32_CLOCK48_REQUIRED TRUE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSI
#define STM32_PLLM_VALUE 16
#define STM32_PLLSRC STM32_PLLSRC_HSE
#define STM32_PLLM_VALUE 8
#define STM32_PLLN_VALUE 384
#define STM32_PLLP_VALUE 4
#define STM32_PLLQ_VALUE 8
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV4
#define STM32_PPRE2 STM32_PPRE2_DIV2
#define STM32_RTCSEL STM32_RTCSEL_LSI
#define STM32_RTCSEL STM32_RTCSEL_LSE
#define STM32_RTCPRE_VALUE 8
#define STM32_MCO1SEL STM32_MCO1SEL_HSI
#define STM32_MCO1SEL STM32_MCO1SEL_HSE
#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
#define STM32_MCO2PRE STM32_MCO2PRE_DIV5

Просмотреть файл

@ -0,0 +1,12 @@
//
// Copyright (c) 2017 The nanoFramework project contributors
// See LICENSE file in the project root for full license information.
//
#include <nanoHAL.h>
void HAL_EnterBooterMode()
{
}
bool g_fDoNotUninitializeDebuggerPort = false;

Просмотреть файл

@ -29,4 +29,5 @@
/////////////////////////////////////////////////////////////////////////////////////////
#endif /* _TARGET_COMMON_H_ */