STM32C031 demo compiles, ready for testing.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@16353 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
1014f947e9
commit
0de96b017a
|
@ -109,8 +109,8 @@ include $(CHIBIOS)/os/common/ports/ARMv6-M/compilers/GCC/mk/port.mk
|
|||
# Auto-build files in ./source recursively.
|
||||
include $(CHIBIOS)/tools/mk/autobuild.mk
|
||||
# Other files (optional).
|
||||
#include $(CHIBIOS)/os/test/test.mk
|
||||
#include $(CHIBIOS)/test/nil/nil_test.mk
|
||||
include $(CHIBIOS)/os/test/test.mk
|
||||
include $(CHIBIOS)/test/nil/nil_test.mk
|
||||
#include $(CHIBIOS)/test/oslib/oslib_test.mk
|
||||
|
||||
# Define linker script file here
|
||||
|
|
|
@ -14,13 +14,83 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "hal.h"
|
||||
#include "ch.h"
|
||||
#include "nil_test_root.h"
|
||||
//#include "oslib_test_root.h"
|
||||
|
||||
/*
|
||||
* Blinker thread #1.
|
||||
*/
|
||||
static THD_WORKING_AREA(waThread1, 128);
|
||||
static THD_FUNCTION(Thread1, arg) {
|
||||
|
||||
(void)arg;
|
||||
|
||||
while (true) {
|
||||
while (true) {
|
||||
palClearLine(LINE_LED_GREEN);
|
||||
chThdSleepMilliseconds(500);
|
||||
palSetLine(LINE_LED_GREEN);
|
||||
chThdSleepMilliseconds(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Tester thread.
|
||||
*/
|
||||
THD_WORKING_AREA(waThread3, 256);
|
||||
THD_FUNCTION(Thread3, arg) {
|
||||
|
||||
(void)arg;
|
||||
|
||||
/*
|
||||
* Activates the serial driver 1 using the driver default configuration.
|
||||
* PA9 and PA10 are routed to USART1.
|
||||
*/
|
||||
sdStart(&SD2, NULL);
|
||||
|
||||
/* Welcome message.*/
|
||||
chnWrite(&SD2, (const uint8_t *)"Hello World!\r\n", 14);
|
||||
|
||||
/* Waiting for button push and activation of the test suite.*/
|
||||
while (true) {
|
||||
if (palReadLine(LINE_BUTTON) == PAL_LOW) {
|
||||
test_execute((BaseSequentialStream *)&SD2, &nil_test_suite);
|
||||
//test_execute((BaseSequentialStream *)&SD2, &oslib_test_suite);
|
||||
}
|
||||
chThdSleepMilliseconds(500);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Threads creation table, one entry per thread.
|
||||
*/
|
||||
THD_TABLE_BEGIN
|
||||
THD_TABLE_THREAD(0, "blinker1", waThread1, Thread1, NULL)
|
||||
THD_TABLE_THREAD(4, "tester", waThread3, Thread3, NULL)
|
||||
THD_TABLE_END
|
||||
|
||||
/*
|
||||
* Application entry point.
|
||||
*/
|
||||
int main(void) {
|
||||
|
||||
/*
|
||||
* System initializations.
|
||||
* - HAL initialization, this also initializes the configured device drivers
|
||||
* and performs the board-specific initializations.
|
||||
* - Kernel initialization, the main() function becomes a thread and the
|
||||
* RTOS is active.
|
||||
*/
|
||||
halInit();
|
||||
chSysInit();
|
||||
|
||||
/* This is now the idle thread loop, you may perform here a low priority
|
||||
task but you must never try to sleep or wait in this loop. Note that
|
||||
this tasks runs at the lowest priority level so any instruction added
|
||||
here will be executed after all other tasks have been started.*/
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -870,6 +870,11 @@
|
|||
#error "invalid source selected for USART1 clock"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART2 clock frequency.
|
||||
*/
|
||||
#define STM32_USART2CLK hal_lld_get_clock_point(CLK_PCLK)
|
||||
|
||||
/**
|
||||
* @brief I2C1 clock frequency.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue