STM32F746 demo complete.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8334 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Giovanni Di Sirio 2015-09-29 08:42:00 +00:00
parent bd746baee2
commit 4aea87925e
4 changed files with 29 additions and 27 deletions

View File

@ -100,7 +100,7 @@ include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional). # Other files (optional).
include $(CHIBIOS)/test/rt/test.mk include $(CHIBIOS)/test/rt/test.mk
include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk
#include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
# Define linker script file here # Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F746xG.ld LDSCRIPT= $(STARTUPLD)/STM32F746xG.ld

View File

@ -27,9 +27,8 @@
#include "lwipthread.h" #include "lwipthread.h"
#include "web/web.h" #include "web/web.h"
//#include "ff.h" #include "ff.h"
#if 0
/*===========================================================================*/ /*===========================================================================*/
/* Card insertion monitor. */ /* Card insertion monitor. */
/*===========================================================================*/ /*===========================================================================*/
@ -150,7 +149,6 @@ static FRESULT scan_files(BaseSequentialStream *chp, char *path) {
} }
return res; return res;
} }
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB related stuff. */ /* USB related stuff. */
@ -520,7 +518,6 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
chThdWait(tp); chThdWait(tp);
} }
#if 0
static void cmd_tree(BaseSequentialStream *chp, int argc, char *argv[]) { static void cmd_tree(BaseSequentialStream *chp, int argc, char *argv[]) {
FRESULT err; FRESULT err;
uint32_t clusters; uint32_t clusters;
@ -547,13 +544,12 @@ static void cmd_tree(BaseSequentialStream *chp, int argc, char *argv[]) {
fbuff[0] = 0; fbuff[0] = 0;
scan_files(chp, (char *)fbuff); scan_files(chp, (char *)fbuff);
} }
#endif
static const ShellCommand commands[] = { static const ShellCommand commands[] = {
{"mem", cmd_mem}, {"mem", cmd_mem},
{"threads", cmd_threads}, {"threads", cmd_threads},
{"test", cmd_test}, {"test", cmd_test},
// {"tree", cmd_tree}, {"tree", cmd_tree},
{NULL, NULL} {NULL, NULL}
}; };
@ -566,7 +562,6 @@ static const ShellConfig shell_cfg1 = {
/* Main and generic code. */ /* Main and generic code. */
/*===========================================================================*/ /*===========================================================================*/
#if 0
/* /*
* Card insertion event. * Card insertion event.
*/ */
@ -597,7 +592,6 @@ static void RemoveHandler(eventid_t id) {
sdcDisconnect(&SDCD1); sdcDisconnect(&SDCD1);
fs_ready = FALSE; fs_ready = FALSE;
} }
#endif
/* /*
* Green LED blinker thread, times are in milliseconds. * Green LED blinker thread, times are in milliseconds.
@ -608,9 +602,8 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg; (void)arg;
chRegSetThreadName("blinker"); chRegSetThreadName("blinker");
while (true) { while (true) {
// palTogglePad(GPIOC, GPIOC_LED); palTogglePad(GPIOI, GPIOI_ARD_D13);
// chThdSleepMilliseconds(fs_ready ? 125 : 500); chThdSleepMilliseconds(fs_ready ? 250 : 500);
chThdSleepMilliseconds(500);
} }
} }
@ -619,11 +612,11 @@ static THD_FUNCTION(Thread1, arg) {
*/ */
int main(void) { int main(void) {
static thread_t *shelltp = NULL; static thread_t *shelltp = NULL;
// static const evhandler_t evhndl[] = { static const evhandler_t evhndl[] = {
// InsertHandler, InsertHandler,
// RemoveHandler RemoveHandler
// }; };
// event_listener_t el0, el1; event_listener_t el0, el1;
/* /*
* System initializations. * System initializations.
@ -637,6 +630,11 @@ int main(void) {
chSysInit(); chSysInit();
lwipInit(NULL); lwipInit(NULL);
/*
* Initialize board LED.
*/
palSetPadMode(GPIOI, GPIOI_ARD_D13, PAL_MODE_OUTPUT_PUSHPULL);
/* /*
* Initializes a serial-over-USB CDC driver. * Initializes a serial-over-USB CDC driver.
*/ */
@ -668,7 +666,7 @@ int main(void) {
/* /*
* Activates the card insertion monitor. * Activates the card insertion monitor.
*/ */
// tmr_init(&SDCD1); tmr_init(&SDCD1);
/* /*
* Creates the blinker thread. * Creates the blinker thread.
@ -685,8 +683,8 @@ int main(void) {
* Normal main() thread activity, in this demo it does nothing except * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and listen for events. * sleeping in a loop and listen for events.
*/ */
// chEvtRegister(&inserted_event, &el0, 0); chEvtRegister(&inserted_event, &el0, 0);
// chEvtRegister(&removed_event, &el1, 1); chEvtRegister(&removed_event, &el1, 1);
while (true) { while (true) {
if (!shelltp && (SDU2.config->usbp->state == USB_ACTIVE)) if (!shelltp && (SDU2.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO); shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
@ -696,7 +694,6 @@ int main(void) {
} }
if (palReadPad(GPIOI, GPIOI_BUTTON_USER) != 0) { if (palReadPad(GPIOI, GPIOI_BUTTON_USER) != 0) {
} }
// chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(500))); chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(500)));
chThdSleepMilliseconds(500);
} }
} }

View File

@ -97,8 +97,8 @@ bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
bool sdc_lld_is_write_protected(SDCDriver *sdcp) { bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp; (void)sdcp;
/* TODO: Fill the implementation.*/
return false; return !palReadPad(GPIOC, GPIOC_SD_DETECT);
} }
#endif /* HAL_USE_SDC */ #endif /* HAL_USE_SDC */

View File

@ -10,7 +10,12 @@
</configuration_settings> </configuration_settings>
<board_name>STMicroelectronics STM32F746G-Discovery</board_name> <board_name>STMicroelectronics STM32F746G-Discovery</board_name>
<board_id>ST_STM32F746G_DISCOVERY</board_id> <board_id>ST_STM32F746G_DISCOVERY</board_id>
<board_functions></board_functions> <board_functions>
<sdc_lld_is_write_protected><![CDATA[
(void)sdcp;
return !palReadPad(GPIOC, GPIOC_SD_DETECT);]]></sdc_lld_is_write_protected>
</board_functions>
<headers></headers> <headers></headers>
<ethernet_phy> <ethernet_phy>
<identifier>MII_LAN8742A_ID</identifier> <identifier>MII_LAN8742A_ID</identifier>