mirror of
git://projects.qi-hardware.com/f32xbase.git
synced 2024-11-27 16:56:17 +02:00
fw/example/ - very simple demo application
This commit is contained in:
parent
e23181e40b
commit
e038f87196
1
fw/example/.version
Normal file
1
fw/example/.version
Normal file
@ -0,0 +1 @@
|
||||
1
|
20
fw/example/Makefile
Normal file
20
fw/example/Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
#
|
||||
# example/Makefile - Example application
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
MAIN=example
|
||||
OBJS=$(MAIN) version
|
||||
|
||||
include ../common/Makefile.system
|
||||
include ../common/Makefile.common
|
||||
|
||||
CFLAGS += -I../include
|
||||
LDFLAGS += --code-loc $(PAYLOAD_START)
|
56
fw/example/example.c
Normal file
56
fw/example/example.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* example/example.c - Example application
|
||||
*
|
||||
* Written 2010 by Werner Almesberger
|
||||
* Copyright 2010 Werner Almesberger
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "regs.h"
|
||||
|
||||
|
||||
static void count(void)
|
||||
{
|
||||
union {
|
||||
uint32_t n;
|
||||
uint8_t a[3];
|
||||
} c;
|
||||
|
||||
c.n = 0;
|
||||
while (1) {
|
||||
P0 = c.a[0];
|
||||
P2 = c.a[1];
|
||||
P3 = c.a[2];
|
||||
c.n++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
/*
|
||||
* VDD monitor enable sequence, section 7.2
|
||||
*
|
||||
* - enable voltage monitor
|
||||
* - wait for monitor to stabilize
|
||||
* - enable VDD monitor reset
|
||||
*/
|
||||
|
||||
VDM0CN = VDMEN;
|
||||
while (!(VDM0CN & VDDSTAT));
|
||||
RSTSRC = PORSF;
|
||||
|
||||
/*
|
||||
* Go to 24 Mhz
|
||||
*/
|
||||
OSCICN |= IFCN0 | IFCN1;
|
||||
|
||||
count();
|
||||
}
|
26
fw/example/version.h
Normal file
26
fw/example/version.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* boot/version.h - Automatically generated version string
|
||||
*
|
||||
* Written 2008 by Werner Almesberger
|
||||
* Copyright 2008 Werner Almesberger
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Oddly, sdcc seems to insist on the "extern" to mean "declaration".
|
||||
*/
|
||||
|
||||
extern const char *build_date;
|
||||
extern const uint16_t build_number;
|
||||
|
||||
#endif /* !VERSION_H */
|
Loading…
Reference in New Issue
Block a user