コード例 #1
0
ファイル: init.c プロジェクト: a-otti/piksi_firmware
void init(void)
{
  /* Delay on start-up as some programmers reset the STM twice. */
  for (u32 i = 0; i < 600000; i++)
    __asm__("nop");

  led_setup();

  nap_setup();

  s32 serial_number = nap_conf_rd_serial_number();
  if (serial_number < 0) {
    /* TODO: Handle this properly! */
    serial_number = 0x2222;
  }
  sbp_setup(serial_number);

  fault_handling_setup();

  nap_callbacks_setup();

  reset_callback_register();

  flash_callbacks_register();

  stm_unique_id_callback_register();
}
コード例 #2
0
int main(void)
{
  for (u32 i = 0; i < 600000; i++)
    __asm__("nop");

	led_setup();
  led_on(LED_GREEN);
  led_on(LED_RED);

  /* NAP is not required for this test. */
  nap_conf_b_setup();
  nap_conf_b_clear();

  sbp_setup(0, 0);

  while (1) {
    led_toggle(LED_RED);
    led_toggle(LED_GREEN);
    for (int i = 0; i < 10000; i++) /* Wait a bit. */
      __asm__("NOP");
    printf("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\r");
  }

	return 0;
}
コード例 #3
0
int main(void)
{

  led_setup();
  led_on(LED_GREEN);
  led_on(LED_RED);

  /* Setup and hold the FPGA PROGRAM_B line low so that the FPGA does not
   * contest the flash SPI bus */
  nap_conf_b_setup();
  nap_conf_b_clear();

  spi_setup();
  sbp_setup(0);
  m25_setup();
  stm_flash_callbacks_setup();

  for (u32 i = 0; i < 600000; i++)
    __asm__("nop");

  printf("\n\nFirmware info - git: " GIT_VERSION ", built: " __DATE__ " " __TIME__ "\n");
  printf("--- M25 FLASH TEST ---\n");

  while (1) {
    DO_EVERY(300,
      led_toggle(LED_GREEN);
      led_toggle(LED_RED);
    );
    sbp_process_messages();
  }