Initial commit

This commit is contained in:
Daniele Lacamera 2019-03-26 09:28:17 +01:00
commit a67219081c
21 changed files with 4691 additions and 0 deletions

4
.gdbinit Normal file
View file

@ -0,0 +1,4 @@
tar rem:3333
file image.elf
foc c

7
.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
*.o
*.a
*.bin
*.img
*.elf
*.map
tags

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "unicore-mx"]
path = unicore-mx
url = https://github.com/insane-adding-machines/unicore-mx.git

340
LICENSE Normal file
View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

36
Makefile Normal file
View file

@ -0,0 +1,36 @@
CROSS_COMPILE:=arm-none-eabi-
CC:=$(CROSS_COMPILE)gcc
LD:=$(CROSS_COMPILE)gcc
OBJS:=startup.o main.o system.o button.o usart.o img/chili.o cga_8x8.o
LSCRIPT:=target-f103.ld
OBJCOPY:=$(CROSS_COMPILE)objcopy
UMX:=unicore-mx/lib/libucmx_stm32f1.a
UMXFLAGS:=-Iunicore-mx/include/ -DSTM32F1
CFLAGS:=-mcpu=cortex-m3 -mthumb -g -ggdb -Wall -Wno-main -Wstack-usage=200 -ffreestanding -Wno-unused $(UMXFLAGS) -nostdlib
ASFLAGS+=-mthumb -mlittle-endian -mthumb-interwork -ggdb -ffreestanding -mcpu=cortex-m3
LDFLAGS:=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map -nostdlib
#all: image.bin
image.bin: image.elf
$(OBJCOPY) -O binary $^ $@
image.elf: $(UMX) $(OBJS) $(LSCRIPT)
$(LD) $(LDFLAGS) $(OBJS) $(UMX) -o $@
$(UMX):
make -C unicore-mx FP_FLAGS="-mfloat-abi=soft" PREFIX=arm-frosted-eabi TARGETS=stm32/f1
startup.o: startup.c
main.o: main.c
clean:
rm -f image.bin image.elf *.o image.map

67
button.c Normal file
View file

@ -0,0 +1,67 @@
/* (c) Daniele Lacamera 2019
* GPL
*/
#include <stdint.h>
#include <stdlib.h>
#include "system.h"
#include "button.h"
#include "unicore-mx/stm32/gpio.h"
#include "unicore-mx/stm32/exti.h"
#include "unicore-mx/stm32/rcc.h"
#include <unicore-mx/cm3/nvic.h>
volatile int button_press_pending = 0;
#define KEYA_PIN 13 // pc13
#define KEYB_PIN 2 // pb2
void button_setup(void)
{
int i;
uint32_t exti_irq;
rcc_periph_clock_enable(RCC_GPIOB);
rcc_periph_clock_enable(RCC_GPIOC);
rcc_periph_clock_enable(RCC_AFIO);
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, KEYB_PIN);
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, KEYA_PIN);
gpio_clear(GPIOB, KEYB_PIN);
gpio_clear(GPIOC, KEYA_PIN);
nvic_enable_irq(NVIC_EXTI15_10_IRQ);
nvic_enable_irq(NVIC_EXTI2_IRQ);
nvic_set_priority(NVIC_EXTI15_10_IRQ, 1);
nvic_set_priority(NVIC_EXTI2_IRQ, 1);
gpio_set_mode(GPIOC, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, KEYA_PIN);
gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, KEYB_PIN);
exti_select_source(KEYA_PIN, GPIOC);
exti_select_source(KEYB_PIN, GPIOB);
}
void button_start_read(void)
{
exti_set_trigger(KEYA_PIN, EXTI_TRIGGER_FALLING);
exti_set_trigger(KEYB_PIN, EXTI_TRIGGER_RISING);
exti_enable_request(KEYA_PIN);
}
void isr_exti15_10(void)
{
exti_reset_request(KEYA_PIN);
button_press_pending++;
}
void isr_exti2(void)
{
exti_reset_request(KEYB_PIN);
button_press_pending++;
}

23
button.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef BUTTON_H_INCLUDED
#define BUTTON_H_INCLUDED
extern volatile int button_press_pending;
/* Selectors: PB8, PB9 */
#define PSEL_0 (1 << 8)
#define PSEL_1 (1 << 9)
/* Input lines: PH6, PA8, PB15, PB14 */
#define PLINE_0 (1 << 6)
#define PLINE_1 (1 << 8)
#define PLINE_2 (1 << 15)
#define PLINE_3 (1 << 14)
#define PUSER (1 << 11)
void button_setup(void);
void button_start_read(void);
int button_is_pressed(void);
#endif

793
cga_8x8.c Normal file
View file

@ -0,0 +1,793 @@
/*
* This file was originally part of frosted.
*
* frosted is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
*
* frosted is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with frosted. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Daniele Lacamera
*
* Automatically generated using CGA 8x8 font by EPTO
*
*/
const unsigned char fb_font[256][8] = {
{ //Ascii 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 1
0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E,
},
{ //Ascii 2
0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E,
},
{ //Ascii 3
0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00,
},
{ //Ascii 4
0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00,
},
{ //Ascii 5
0x38, 0x7C, 0x38, 0xFE, 0xFE, 0xD6, 0x10, 0x38,
},
{ //Ascii 6
0x10, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x10, 0x38,
},
{ //Ascii 7
0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00,
},
{ //Ascii 8
0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF,
},
{ //Ascii 9
0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00,
},
{ //Ascii 10
0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF,
},
{ //Ascii 11
0x0F, 0x03, 0x05, 0x7D, 0x84, 0x84, 0x84, 0x78,
},
{ //Ascii 12
0x3C, 0x42, 0x42, 0x42, 0x3C, 0x18, 0x7E, 0x18,
},
{ //Ascii 13
0x3F, 0x21, 0x3F, 0x20, 0x20, 0x60, 0xE0, 0xC0,
},
{ //Ascii 14
0x3F, 0x21, 0x3F, 0x21, 0x23, 0x67, 0xE6, 0xC0,
},
{ //Ascii 15
0x18, 0xDB, 0x3C, 0xE7, 0xE7, 0x3C, 0xDB, 0x18,
},
{ //Ascii 16
0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00,
},
{ //Ascii 17
0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00,
},
{ //Ascii 18
0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18,
},
{ //Ascii 19
0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x24, 0x00,
},
{ //Ascii 20
0x7F, 0x92, 0x92, 0x72, 0x12, 0x12, 0x12, 0x00,
},
{ //Ascii 21
0x3E, 0x63, 0x38, 0x44, 0x44, 0x38, 0xCC, 0x78,
},
{ //Ascii 22
0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00,
},
{ //Ascii 23
0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF,
},
{ //Ascii 24
0x10, 0x38, 0x7C, 0x54, 0x10, 0x10, 0x10, 0x00,
},
{ //Ascii 25
0x10, 0x10, 0x10, 0x54, 0x7C, 0x38, 0x10, 0x00,
},
{ //Ascii 26
0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00,
},
{ //Ascii 27
0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00,
},
{ //Ascii 28
0x00, 0x00, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00,
},
{ //Ascii 29
0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00,
},
{ //Ascii 30
0x00, 0x10, 0x38, 0x7C, 0xFE, 0xFE, 0x00, 0x00,
},
{ //Ascii 31
0x00, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, 0x00,
},
{ //Ascii 32
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 33
0x10, 0x38, 0x38, 0x10, 0x10, 0x00, 0x10, 0x00,
},
{ //Ascii 34
0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 35
0x24, 0x24, 0x7E, 0x24, 0x7E, 0x24, 0x24, 0x00,
},
{ //Ascii 36
0x18, 0x3E, 0x40, 0x3C, 0x02, 0x7C, 0x18, 0x00,
},
{ //Ascii 37
0x00, 0x62, 0x64, 0x08, 0x10, 0x26, 0x46, 0x00,
},
{ //Ascii 38
0x30, 0x48, 0x30, 0x56, 0x88, 0x88, 0x76, 0x00,
},
{ //Ascii 39
0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 40
0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, 0x00,
},
{ //Ascii 41
0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00,
},
{ //Ascii 42
0x00, 0x44, 0x38, 0xFE, 0x38, 0x44, 0x00, 0x00,
},
{ //Ascii 43
0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00,
},
{ //Ascii 44
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20,
},
{ //Ascii 45
0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 46
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
},
{ //Ascii 47
0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00,
},
{ //Ascii 48
0x3C, 0x42, 0x46, 0x4A, 0x52, 0x62, 0x3C, 0x00,
},
{ //Ascii 49
0x10, 0x30, 0x50, 0x10, 0x10, 0x10, 0x7C, 0x00,
},
{ //Ascii 50
0x3C, 0x42, 0x02, 0x0C, 0x30, 0x42, 0x7E, 0x00,
},
{ //Ascii 51
0x3C, 0x42, 0x02, 0x1C, 0x02, 0x42, 0x3C, 0x00,
},
{ //Ascii 52
0x08, 0x18, 0x28, 0x48, 0xFE, 0x08, 0x1C, 0x00,
},
{ //Ascii 53
0x7E, 0x40, 0x7C, 0x02, 0x02, 0x42, 0x3C, 0x00,
},
{ //Ascii 54
0x1C, 0x20, 0x40, 0x7C, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 55
0x7E, 0x42, 0x04, 0x08, 0x10, 0x10, 0x10, 0x00,
},
{ //Ascii 56
0x3C, 0x42, 0x42, 0x3C, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 57
0x3C, 0x42, 0x42, 0x3E, 0x02, 0x04, 0x38, 0x00,
},
{ //Ascii 58
0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00,
},
{ //Ascii 59
0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20,
},
{ //Ascii 60
0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00,
},
{ //Ascii 61
0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00,
},
{ //Ascii 62
0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00,
},
{ //Ascii 63
0x3C, 0x42, 0x02, 0x04, 0x08, 0x00, 0x08, 0x00,
},
{ //Ascii 64
0x3C, 0x42, 0x5E, 0x52, 0x5E, 0x40, 0x3C, 0x00,
},
{ //Ascii 65
0x18, 0x24, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x00,
},
{ //Ascii 66
0x7C, 0x22, 0x22, 0x3C, 0x22, 0x22, 0x7C, 0x00,
},
{ //Ascii 67
0x1C, 0x22, 0x40, 0x40, 0x40, 0x22, 0x1C, 0x00,
},
{ //Ascii 68
0x78, 0x24, 0x22, 0x22, 0x22, 0x24, 0x78, 0x00,
},
{ //Ascii 69
0x7E, 0x22, 0x28, 0x38, 0x28, 0x22, 0x7E, 0x00,
},
{ //Ascii 70
0x7E, 0x22, 0x28, 0x38, 0x28, 0x20, 0x70, 0x00,
},
{ //Ascii 71
0x1C, 0x22, 0x40, 0x40, 0x4E, 0x22, 0x1E, 0x00,
},
{ //Ascii 72
0x42, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x00,
},
{ //Ascii 73
0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00,
},
{ //Ascii 74
0x0E, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00,
},
{ //Ascii 75
0x62, 0x24, 0x28, 0x30, 0x28, 0x24, 0x63, 0x00,
},
{ //Ascii 76
0x70, 0x20, 0x20, 0x20, 0x20, 0x22, 0x7E, 0x00,
},
{ //Ascii 77
0x63, 0x55, 0x49, 0x41, 0x41, 0x41, 0x41, 0x00,
},
{ //Ascii 78
0x62, 0x52, 0x4A, 0x46, 0x42, 0x42, 0x42, 0x00,
},
{ //Ascii 79
0x18, 0x24, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00,
},
{ //Ascii 80
0x7C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x70, 0x00,
},
{ //Ascii 81
0x3C, 0x42, 0x42, 0x42, 0x4A, 0x3C, 0x03, 0x00,
},
{ //Ascii 82
0x7C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x72, 0x00,
},
{ //Ascii 83
0x3C, 0x42, 0x40, 0x3C, 0x02, 0x42, 0x3C, 0x00,
},
{ //Ascii 84
0x7F, 0x49, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00,
},
{ //Ascii 85
0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 86
0x41, 0x41, 0x41, 0x41, 0x22, 0x14, 0x08, 0x00,
},
{ //Ascii 87
0x41, 0x41, 0x41, 0x49, 0x49, 0x49, 0x36, 0x00,
},
{ //Ascii 88
0x41, 0x22, 0x14, 0x08, 0x14, 0x22, 0x41, 0x00,
},
{ //Ascii 89
0x41, 0x22, 0x14, 0x08, 0x08, 0x08, 0x1C, 0x00,
},
{ //Ascii 90
0x7F, 0x42, 0x04, 0x08, 0x10, 0x21, 0x7F, 0x00,
},
{ //Ascii 91
0x78, 0x40, 0x40, 0x40, 0x40, 0x40, 0x78, 0x00,
},
{ //Ascii 92
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
},
{ //Ascii 93
0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x00,
},
{ //Ascii 94
0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 95
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
},
{ //Ascii 96
0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 97
0x00, 0x00, 0x3C, 0x02, 0x3E, 0x42, 0x3F, 0x00,
},
{ //Ascii 98
0x60, 0x20, 0x20, 0x2E, 0x31, 0x31, 0x2E, 0x00,
},
{ //Ascii 99
0x00, 0x00, 0x3C, 0x42, 0x40, 0x42, 0x3C, 0x00,
},
{ //Ascii 100
0x06, 0x02, 0x02, 0x3A, 0x46, 0x46, 0x3B, 0x00,
},
{ //Ascii 101
0x00, 0x00, 0x3C, 0x42, 0x7E, 0x40, 0x3C, 0x00,
},
{ //Ascii 102
0x0C, 0x12, 0x10, 0x38, 0x10, 0x10, 0x38, 0x00,
},
{ //Ascii 103
0x00, 0x00, 0x3D, 0x42, 0x42, 0x3E, 0x02, 0x7C,
},
{ //Ascii 104
0x60, 0x20, 0x2C, 0x32, 0x22, 0x22, 0x62, 0x00,
},
{ //Ascii 105
0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00,
},
{ //Ascii 106
0x02, 0x00, 0x06, 0x02, 0x02, 0x42, 0x42, 0x3C,
},
{ //Ascii 107
0x60, 0x20, 0x24, 0x28, 0x30, 0x28, 0x26, 0x00,
},
{ //Ascii 108
0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00,
},
{ //Ascii 109
0x00, 0x00, 0x76, 0x49, 0x49, 0x49, 0x49, 0x00,
},
{ //Ascii 110
0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x00,
},
{ //Ascii 111
0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 112
0x00, 0x00, 0x6C, 0x32, 0x32, 0x2C, 0x20, 0x70,
},
{ //Ascii 113
0x00, 0x00, 0x36, 0x4C, 0x4C, 0x34, 0x04, 0x0E,
},
{ //Ascii 114
0x00, 0x00, 0x6C, 0x32, 0x22, 0x20, 0x70, 0x00,
},
{ //Ascii 115
0x00, 0x00, 0x3E, 0x40, 0x3C, 0x02, 0x7C, 0x00,
},
{ //Ascii 116
0x10, 0x10, 0x7C, 0x10, 0x10, 0x12, 0x0C, 0x00,
},
{ //Ascii 117
0x00, 0x00, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00,
},
{ //Ascii 118
0x00, 0x00, 0x41, 0x41, 0x22, 0x14, 0x08, 0x00,
},
{ //Ascii 119
0x00, 0x00, 0x41, 0x49, 0x49, 0x49, 0x36, 0x00,
},
{ //Ascii 120
0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
},
{ //Ascii 121
0x00, 0x00, 0x42, 0x42, 0x42, 0x3E, 0x02, 0x7C,
},
{ //Ascii 122
0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00,
},
{ //Ascii 123
0x0C, 0x10, 0x10, 0x60, 0x10, 0x10, 0x0C, 0x00,
},
{ //Ascii 124
0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00,
},
{ //Ascii 125
0x30, 0x08, 0x08, 0x06, 0x08, 0x08, 0x30, 0x00,
},
{ //Ascii 126
0x32, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 127
0x00, 0x08, 0x14, 0x22, 0x41, 0x41, 0x7F, 0x00,
},
{ //Ascii 128
0x3C, 0x42, 0x40, 0x42, 0x3C, 0x0C, 0x02, 0x3C,
},
{ //Ascii 129
0x00, 0x44, 0x00, 0x44, 0x44, 0x44, 0x3E, 0x00,
},
{ //Ascii 130
0x0C, 0x00, 0x3C, 0x42, 0x7E, 0x40, 0x3C, 0x00,
},
{ //Ascii 131
0x3C, 0x42, 0x38, 0x04, 0x3C, 0x44, 0x3E, 0x00,
},
{ //Ascii 132
0x42, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3E, 0x00,
},
{ //Ascii 133
0x30, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3E, 0x00,
},
{ //Ascii 134
0x10, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3E, 0x00,
},
{ //Ascii 135
0x00, 0x00, 0x3C, 0x40, 0x40, 0x3C, 0x06, 0x1C,
},
{ //Ascii 136
0x3C, 0x42, 0x3C, 0x42, 0x7E, 0x40, 0x3C, 0x00,
},
{ //Ascii 137
0x42, 0x00, 0x3C, 0x42, 0x7E, 0x40, 0x3C, 0x00,
},
{ //Ascii 138
0x30, 0x00, 0x3C, 0x42, 0x7E, 0x40, 0x3C, 0x00,
},
{ //Ascii 139
0x24, 0x00, 0x18, 0x08, 0x08, 0x08, 0x1C, 0x00,
},
{ //Ascii 140
0x7C, 0x82, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00,
},
{ //Ascii 141
0x30, 0x00, 0x18, 0x08, 0x08, 0x08, 0x1C, 0x00,
},
{ //Ascii 142
0x42, 0x18, 0x24, 0x42, 0x7E, 0x42, 0x42, 0x00,
},
{ //Ascii 143
0x18, 0x18, 0x00, 0x3C, 0x42, 0x7E, 0x42, 0x00,
},
{ //Ascii 144
0x0C, 0x00, 0x7C, 0x20, 0x38, 0x20, 0x7C, 0x00,
},
{ //Ascii 145
0x00, 0x00, 0x33, 0x0C, 0x3F, 0x44, 0x3B, 0x00,
},
{ //Ascii 146
0x1F, 0x24, 0x44, 0x7F, 0x44, 0x44, 0x47, 0x00,
},
{ //Ascii 147
0x18, 0x24, 0x00, 0x3C, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 148
0x00, 0x42, 0x00, 0x3C, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 149
0x20, 0x10, 0x00, 0x3C, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 150
0x18, 0x24, 0x00, 0x42, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 151
0x20, 0x10, 0x00, 0x42, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 152
0x00, 0x42, 0x00, 0x42, 0x42, 0x3E, 0x02, 0x3C,
},
{ //Ascii 153
0x42, 0x18, 0x24, 0x42, 0x42, 0x24, 0x18, 0x00,
},
{ //Ascii 154
0x42, 0x00, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 155
0x08, 0x08, 0x3E, 0x40, 0x40, 0x3E, 0x08, 0x08,
},
{ //Ascii 156
0x18, 0x24, 0x20, 0x70, 0x20, 0x42, 0x7C, 0x00,
},
{ //Ascii 157
0x44, 0x28, 0x7C, 0x10, 0x7C, 0x10, 0x10, 0x00,
},
{ //Ascii 158
0xF8, 0x4C, 0x78, 0x44, 0x4F, 0x44, 0x45, 0xE6,
},
{ //Ascii 159
0x1C, 0x12, 0x10, 0x7C, 0x10, 0x10, 0x90, 0x60,
},
{ //Ascii 160
0x0C, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3E, 0x00,
},
{ //Ascii 161
0x0C, 0x00, 0x18, 0x08, 0x08, 0x08, 0x1C, 0x00,
},
{ //Ascii 162
0x04, 0x08, 0x00, 0x3C, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 163
0x00, 0x04, 0x08, 0x42, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 164
0x32, 0x4C, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x00,
},
{ //Ascii 165
0x34, 0x4C, 0x00, 0x62, 0x52, 0x4A, 0x46, 0x00,
},
{ //Ascii 166
0x3C, 0x44, 0x44, 0x3E, 0x00, 0x7E, 0x00, 0x00,
},
{ //Ascii 167
0x38, 0x44, 0x44, 0x38, 0x00, 0x7C, 0x00, 0x00,
},
{ //Ascii 168
0x10, 0x00, 0x10, 0x20, 0x40, 0x42, 0x3C, 0x00,
},
{ //Ascii 169
0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x00, 0x00,
},
{ //Ascii 170
0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x00, 0x00,
},
{ //Ascii 171
0x42, 0xC4, 0x48, 0xF6, 0x29, 0x43, 0x8C, 0x1F,
},
{ //Ascii 172
0x42, 0xC4, 0x4A, 0xF6, 0x2A, 0x5F, 0x82, 0x02,
},
{ //Ascii 173
0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,
},
{ //Ascii 174
0x00, 0x12, 0x24, 0x48, 0x24, 0x12, 0x00, 0x00,
},
{ //Ascii 175
0x00, 0x48, 0x24, 0x12, 0x24, 0x48, 0x00, 0x00,
},
{ //Ascii 176
0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88,
},
{ //Ascii 177
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
},
{ //Ascii 178
0xDB, 0x77, 0xDB, 0xEE, 0xDB, 0x77, 0xDB, 0xEE,
},
{ //Ascii 179
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
},
{ //Ascii 180
0x10, 0x10, 0x10, 0x10, 0xF0, 0x10, 0x10, 0x10,
},
{ //Ascii 181
0x10, 0x10, 0xF0, 0x10, 0xF0, 0x10, 0x10, 0x10,
},
{ //Ascii 182
0x14, 0x14, 0x14, 0x14, 0xF4, 0x14, 0x14, 0x14,
},
{ //Ascii 183
0x00, 0x00, 0x00, 0x00, 0xFC, 0x14, 0x14, 0x14,
},
{ //Ascii 184
0x00, 0x00, 0xF0, 0x10, 0xF0, 0x10, 0x10, 0x10,
},
{ //Ascii 185
0x14, 0x14, 0xF4, 0x04, 0xF4, 0x14, 0x14, 0x14,
},
{ //Ascii 186
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
},
{ //Ascii 187
0x00, 0x00, 0xFC, 0x04, 0xF4, 0x14, 0x14, 0x14,
},
{ //Ascii 188
0x14, 0x14, 0xF4, 0x04, 0xFC, 0x00, 0x00, 0x00,
},
{ //Ascii 189
0x14, 0x14, 0x14, 0x14, 0xFC, 0x00, 0x00, 0x00,
},
{ //Ascii 190
0x10, 0x10, 0xF0, 0x10, 0xF0, 0x00, 0x00, 0x00,
},
{ //Ascii 191
0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x10,
},
{ //Ascii 192
0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00,
},
{ //Ascii 193
0x10, 0x10, 0x10, 0x10, 0xFF, 0x00, 0x00, 0x00,
},
{ //Ascii 194
0x00, 0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10,
},
{ //Ascii 195
0x10, 0x10, 0x10, 0x10, 0x1F, 0x10, 0x10, 0x10,
},
{ //Ascii 196
0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
},
{ //Ascii 197
0x10, 0x10, 0x10, 0x10, 0xFF, 0x10, 0x10, 0x10,
},
{ //Ascii 198
0x10, 0x10, 0x1F, 0x10, 0x1F, 0x10, 0x10, 0x10,
},
{ //Ascii 199
0x14, 0x14, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14,
},
{ //Ascii 200
0x14, 0x14, 0x17, 0x10, 0x1F, 0x00, 0x00, 0x00,
},
{ //Ascii 201
0x00, 0x00, 0x1F, 0x10, 0x17, 0x14, 0x14, 0x14,
},
{ //Ascii 202
0x14, 0x14, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00,
},
{ //Ascii 203
0x00, 0x00, 0xFF, 0x00, 0xF7, 0x14, 0x14, 0x14,
},
{ //Ascii 204
0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14, 0x14,
},
{ //Ascii 205
0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
},
{ //Ascii 206
0x14, 0x14, 0xF7, 0x00, 0xF7, 0x14, 0x14, 0x14,
},
{ //Ascii 207
0x10, 0x10, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
},
{ //Ascii 208
0x14, 0x14, 0x14, 0x14, 0xFF, 0x00, 0x00, 0x00,
},
{ //Ascii 209
0x00, 0x00, 0xFF, 0x00, 0xFF, 0x10, 0x10, 0x10,
},
{ //Ascii 210
0x00, 0x00, 0x00, 0x00, 0xFF, 0x14, 0x14, 0x14,
},
{ //Ascii 211
0x14, 0x14, 0x14, 0x14, 0x1F, 0x00, 0x00, 0x00,
},
{ //Ascii 212
0x10, 0x10, 0x1F, 0x10, 0x1F, 0x00, 0x00, 0x00,
},
{ //Ascii 213
0x00, 0x00, 0x1F, 0x10, 0x1F, 0x10, 0x10, 0x10,
},
{ //Ascii 214
0x00, 0x00, 0x00, 0x00, 0x1F, 0x14, 0x14, 0x14,
},
{ //Ascii 215
0x14, 0x14, 0x14, 0x14, 0xFF, 0x14, 0x14, 0x14,
},
{ //Ascii 216
0x10, 0x10, 0xFF, 0x10, 0xFF, 0x10, 0x10, 0x10,
},
{ //Ascii 217
0x10, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00,
},
{ //Ascii 218
0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10,
},
{ //Ascii 219
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
},
{ //Ascii 220
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
},
{ //Ascii 221
0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
},
{ //Ascii 222
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
},
{ //Ascii 223
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 224
0x00, 0x00, 0x31, 0x4A, 0x44, 0x4A, 0x31, 0x00,
},
{ //Ascii 225
0x00, 0x3C, 0x42, 0x7C, 0x42, 0x7C, 0x40, 0x40,
},
{ //Ascii 226
0x00, 0x7E, 0x42, 0x40, 0x40, 0x40, 0x40, 0x00,
},
{ //Ascii 227
0x00, 0x3F, 0x54, 0x14, 0x14, 0x14, 0x14, 0x00,
},
{ //Ascii 228
0x7E, 0x42, 0x20, 0x18, 0x20, 0x42, 0x7E, 0x00,
},
{ //Ascii 229
0x00, 0x00, 0x3E, 0x48, 0x48, 0x48, 0x30, 0x00,
},
{ //Ascii 230
0x00, 0x44, 0x44, 0x44, 0x7A, 0x40, 0x40, 0x80,
},
{ //Ascii 231
0x00, 0x33, 0x4C, 0x08, 0x08, 0x08, 0x08, 0x00,
},
{ //Ascii 232
0x7C, 0x10, 0x38, 0x44, 0x44, 0x38, 0x10, 0x7C,
},
{ //Ascii 233
0x18, 0x24, 0x42, 0x7E, 0x42, 0x24, 0x18, 0x00,
},
{ //Ascii 234
0x18, 0x24, 0x42, 0x42, 0x24, 0x24, 0x66, 0x00,
},
{ //Ascii 235
0x1C, 0x20, 0x18, 0x3C, 0x42, 0x42, 0x3C, 0x00,
},
{ //Ascii 236
0x00, 0x62, 0x95, 0x89, 0x95, 0x62, 0x00, 0x00,
},
{ //Ascii 237
0x02, 0x04, 0x3C, 0x4A, 0x52, 0x3C, 0x40, 0x80,
},
{ //Ascii 238
0x0C, 0x10, 0x20, 0x3C, 0x20, 0x10, 0x0C, 0x00,
},
{ //Ascii 239
0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00,
},
{ //Ascii 240
0x00, 0x7E, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00,
},
{ //Ascii 241
0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x7C, 0x00,
},
{ //Ascii 242
0x10, 0x08, 0x04, 0x08, 0x10, 0x00, 0x7E, 0x00,
},
{ //Ascii 243
0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x7E, 0x00,
},
{ //Ascii 244
0x0C, 0x12, 0x12, 0x10, 0x10, 0x10, 0x10, 0x10,
},
{ //Ascii 245
0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x90, 0x60,
},
{ //Ascii 246
0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00,
},
{ //Ascii 247
0x00, 0x32, 0x4C, 0x00, 0x32, 0x4C, 0x00, 0x00,
},
{ //Ascii 248
0x30, 0x48, 0x48, 0x30, 0x00, 0x00, 0x00, 0x00,
},
{ //Ascii 249
0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
},
{ //Ascii 250
0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
},
{ //Ascii 251
0x0F, 0x08, 0x08, 0x08, 0x08, 0xC8, 0x28, 0x18,
},
{ //Ascii 252
0x78, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
},
{ //Ascii 253
0x30, 0x48, 0x10, 0x20, 0x78, 0x00, 0x00, 0x00,
},
{ //Ascii 254
0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00,
},
{ //Ascii 255
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
};

27
channel.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef INCL_CHANNEL_H
#define INCL_CHANNEL_H
#include <stdint.h>
enum channel_trigger_mode_e {
TRIG_NONE = 0,
TRIG_RISE = 1,
TRIG_FALL = 2,
TRIG_BOTH = 3
};
struct di_channel {
int idx;
enum channel_trigger_mode_e trigger;
uint8_t *sample_start;
uint8_t *sample_cur;
};
void timer_capture_on(void);
void timer_capture_off(void);
void probe_on(void);
void probe_off(void);
uint32_t timer_capture_get(void);
#endif

74
framebuffer.h Normal file
View file

@ -0,0 +1,74 @@
#ifndef FRAMEBUFFER_INCLUDED
#define FRAMEBUFFER_INCLUDED
#include <stdint.h>
struct fb_ops;
struct fb_info {
struct fb_var_screeninfo var; /* Current var */
//struct fb_fix_screeninfo fix; /* Current fix */
struct fb_videomode *mode; /* current mode */
//struct backlight_device *bl_dev;
struct fb_ops *fbops;
struct device *dev; /* This is this fb device */
uint8_t *screen_buffer; /* Framebuffer address */
};
struct fb_ops {
/* open/release and usage marking */
int (*fb_open)(struct fb_info *info);
int (*fb_release)(struct fb_info *info);
/* checks var and eventually tweaks it to something supported,
* DO NOT MODIFY PAR */
int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
/* set the video mode according to info->var */
int (*fb_set_par)(struct fb_info *info);
/* set color registers in batch */
int (*fb_setcmap)(uint32_t *cmap, struct fb_info *info);
/* blank display */
int (*fb_blank)(struct fb_info *info);
/* Draws a rectangle */
//void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
/* Copy data from area to another */
//void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
/* Draws a image to the display */
//void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
/* Draws cursor */
//int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);
/* Rotates the display */
//void (*fb_rotate)(struct fb_info *info, int angle);
/* perform fb specific ioctl (optional) */
int (*fb_ioctl)(struct fb_info *info, unsigned int cmd, unsigned long arg);
/* teardown any resources to do with this framebuffer */
void (*fb_destroy)(struct fb_info *info);
};
#ifdef CONFIG_DEVFRAMEBUFFER
/* low-level drivers must call this register function first */
int register_framebuffer(struct fb_info *fb_info);
/* Higher level drivers may access fb screen directly */
unsigned char *framebuffer_get(void);
int framebuffer_setcmap(uint32_t *cmap);
/* kernel init */
int fb_init(void);
#else
# define register_framebuffer(...) ((-ENOENT))
# define fb_init() ((-ENOENT))
#endif
#endif

13
icons.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef ICONS_H
#define ICONS_H
#define ICON_X 7
#define ICON_Y 8
#define ICON_SIZE (ICON_X * ICON_Y)
const uint8_t icon_rise[ICON_SIZE];
const uint8_t icon_rise_on[ICON_SIZE];
const uint8_t icon_fall[ICON_SIZE];
const uint8_t icon_toggle[ICON_SIZE];
#endif

2465
img/chili.c Normal file

File diff suppressed because it is too large Load diff

4
img/chili.h Normal file
View file

@ -0,0 +1,4 @@
#include <stdint.h>
extern const uint8_t chili_ppm[];
extern const uint32_t chili_ppm_len;
extern const uint16_t chili_ppm_width;

426
main.c Normal file
View file

@ -0,0 +1,426 @@
/* (c) Daniele Lacamera 2019
* GPL
*/
#include <unicore-mx/stm32/rcc.h>
#include <unicore-mx/stm32/gpio.h>
#include <unicore-mx/stm32/adc.h>
#include <unicore-mx/stm32/usart.h>
#include <unicore-mx/stm32/fsmc.h>
#include <stdlib.h>
#include <stdint.h>
#include "system.h"
#include "button.h"
#include "img/chili.h"
void usart1_init(void);
void usart1_puts(char *s);
#define FONT_HEIGHT 8
#define FONT_WIDTH 8
#define BGCOLOR (0xfdff)
extern const unsigned char fb_font[256][FONT_WIDTH];
#define BUTTON_DEBOUNCE_TIME 100
/* Board pins:
* KEYA = PC13
* KEYB = PB2
* LED1 = PB0
* LED2 = PB1
*/
/* ADC pins:
* PA3: LM35 temp
* PA2: Light sensor
* PA1: soil sensor
*/
#define TFT_FSMC_ADDRESS_SETUP 9
#define TFT_FSMC_ADDRESS_HOLD 1
#define TFT_FSMC_DATA_SETUP 7
#define TFT_FSMC_BUS_TURNAROUND 0
#define TFT_FSMC_CLKDIVISION 0
#define TFT_FSMC_DATALATENCY 0
#define TFT_FSMC_ACCESS_MODE 0
#define TFT_FSMC_BANK 0
#define TFT_FSMC_DATAWIDHT_16 0x10
#define TFT_FSMC_WRITE_ENABLE 0x1000
#define FSMC_BTCR(X) (((volatile uint32_t *)(FSMC_BASE)))[X]
#define FSMC_E_BWTR(X) (((volatile uint32_t *)(FSMC_BASE + 0x104)))[X]
#define TFT_REG (*((volatile uint16_t *) 0x60000000))
#define TFT_RAM (*((volatile uint16_t *) 0x60020000))
static void TFT_CMD(uint16_t reg, uint16_t val) {
TFT_REG = (reg);
TFT_RAM = (val);
}
#define tft_init_sequence() { \
TFT_CMD(0x0007, 0x0021); \
TFT_CMD(0x0000, 0x0001); \
TFT_CMD(0x0007, 0x0023); \
TFT_CMD(0x0010, 0x0000); \
TFT_CMD(0x0007, 0x0033); \
TFT_CMD(0x0011, 0x6800); \
TFT_CMD(0x0002, 0x0600); \
TFT_CMD(0x0012, 0x6CEB); \
TFT_CMD(0x0003, 0xA8A4); \
TFT_CMD(0x000C, 0x0000); \
TFT_CMD(0x000D, 0x080C); \
TFT_CMD(0x000E, 0x2B00); \
TFT_CMD(0x001E, 0x00B0); \
TFT_CMD(0x0001, 0x2B3F); \
TFT_CMD(0x0005, 0x0000); \
TFT_CMD(0x0006, 0x0000); \
TFT_CMD(0x0016, 0xEF1C); \
TFT_CMD(0x0017, 0x0103); \
TFT_CMD(0x000B, 0x0000); \
TFT_CMD(0x000F, 0x0000); \
TFT_CMD(0x0041, 0x0000); \
TFT_CMD(0x0042, 0x0000); \
TFT_CMD(0x0048, 0x0000); \
TFT_CMD(0x0049, 0x013F); \
TFT_CMD(0x004A, 0x0000); \
TFT_CMD(0x004B, 0x0000); \
TFT_CMD(0x0044, 0xEF00); \
TFT_CMD(0x0045, 0x0000); \
TFT_CMD(0x0046, 0x013F); \
TFT_CMD(0x0030, 0x0707); \
TFT_CMD(0x0031, 0x0204); \
TFT_CMD(0x0032, 0x0204); \
TFT_CMD(0x0033, 0x0502); \
TFT_CMD(0x0034, 0x0507); \
TFT_CMD(0x0035, 0x0204); \
TFT_CMD(0x0036, 0x0204); \
TFT_CMD(0x0037, 0x0502); \
TFT_CMD(0x003A, 0x0302); \
TFT_CMD(0x002F, 0x12BE); \
TFT_CMD(0x003B, 0x0302); \
TFT_CMD(0x0023, 0x0000); \
TFT_CMD(0x0024, 0x0000); \
TFT_CMD(0x0025, 0x8000); \
TFT_CMD(0x004e, 0x0000); \
TFT_CMD(0x004f, 0x0000); \
}
#define TFT_MAX_X 320
#define TFT_MAX_Y 240
#define TFT_GO(x,y) { \
TFT_CMD(0x004E, x); \
TFT_CMD(0x004F, y); \
TFT_REG = 0x22; \
}
void set_pixel(uint16_t x, uint16_t y, uint16_t val)
{
TFT_GO(y, 319 - x);
TFT_REG = 0x22;
TFT_RAM = val;
}
void text_at(uint16_t color, uint32_t x, uint32_t y, char *text)
{
uint32_t i, j;
char fc;
const uint8_t *render;
int nc = 0;
while(text[0]) {
fc = text[0];
render = fb_font[(int)fc];
for (i = 0; i < FONT_HEIGHT; i++) {
for (j = 0; j < FONT_WIDTH; j++) {
int right_shift = (FONT_HEIGHT - 1) - j;
if (render[i] & (1 << (7 - j))) {
set_pixel(x + j + nc * FONT_WIDTH, y + i, color);
}
}
}
nc++;
text++;
}
}
void draw_ppm(const uint8_t *buf, uint32_t len, uint32_t w, uint16_t x, uint16_t y)
{
int i, r = 0;
uint32_t h = (len >> 1) / w;
if (((x + w) > TFT_MAX_X) || ((y + h) > TFT_MAX_Y))
return;
for (i = 0; i < chili_ppm_len;) {
int j = 0;
for (j = 0; j < chili_ppm_width; j++) {
set_pixel(x + j, y + r, *(uint16_t *)(chili_ppm + i));
i+=2;
}
r++;
}
}
void fill_area(uint16_t val, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
{
int i, r = 0;
if (((x + w) > TFT_MAX_X) || ((y + h) > TFT_MAX_Y))
return;
for (i = 0; i < w * h;) {
int j = 0;
for (j = 0; j < w; j++) {
set_pixel(x + j, y + r, val);
i+=2;
}
r++;
}
}
static void tft_init(void)
{
int i;
volatile uint16_t id;
rcc_periph_clock_enable(RCC_FSMC);
rcc_periph_clock_enable(RCC_GPIOB);
rcc_periph_clock_enable(RCC_GPIOD);
rcc_periph_clock_enable(RCC_GPIOE);
gpio_set_mode(GPIOD, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL,
GPIO0 | GPIO1 | GPIO4 | GPIO5 | GPIO7 | GPIO8 | GPIO9 | GPIO10 | GPIO11 | GPIO14 | GPIO15 );
gpio_set_mode(GPIOE, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL,
GPIO3 | GPIO7 | GPIO8 | GPIO9 | GPIO10 | GPIO11 | GPIO12 | GPIO13 | GPIO14 | GPIO15);
/* B5 is backlight */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO5);
gpio_set(GPIOB, GPIO5);
FSMC_BTCR(0) = TFT_FSMC_DATAWIDHT_16 | TFT_FSMC_WRITE_ENABLE;
FSMC_BTCR(1) = TFT_FSMC_ADDRESS_SETUP |
(TFT_FSMC_ADDRESS_HOLD << 4) |
(TFT_FSMC_DATA_SETUP << 8) |
(TFT_FSMC_BUS_TURNAROUND << 16) |
(TFT_FSMC_CLKDIVISION << 20) |
(TFT_FSMC_DATALATENCY << 24) |
TFT_FSMC_ACCESS_MODE;
FSMC_BTCR(0) |= 1;
FSMC_E_BWTR(0) = 0x0FFFFFFF;
TFT_REG = 0x00;
id = TFT_RAM;
tft_init_sequence();
/* Erase screen */
TFT_GO(0,0);
for (i = 0; i < TFT_MAX_X * TFT_MAX_Y; i++)
TFT_RAM = BGCOLOR;
/* Chili */
draw_ppm(chili_ppm, chili_ppm_len, chili_ppm_width, 0, TFT_MAX_Y - 160);
}
static void adc_setup(void)
{
int i;
rcc_periph_clock_enable(RCC_ADC1);
rcc_periph_clock_enable(RCC_GPIOA);
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO3|GPIO1|GPIO2);
adc_power_off(ADC1);
adc_disable_scan_mode(ADC1);
adc_set_single_conversion_mode(ADC1);
adc_disable_external_trigger_regular(ADC1);
adc_set_right_aligned(ADC1);
adc_set_sample_time_on_all_channels(ADC1, ADC_SMPR_SMP_239DOT5CYC);
adc_power_on(ADC1);
for (i = 0; i < 80000; i++)
;
adc_reset_calibration(ADC1);
adc_calibration(ADC1);
}
static uint16_t adc_read(uint8_t channel, int samples)
{
uint8_t seq[2];
uint32_t sum = 0;
uint32_t i,waiting;
seq[0] = channel;
ADC_CR2(ADC1) |= ADC_CR2_ADON;
for (i = 0 ; i < samples; i++) {
adc_set_regular_sequence(ADC1, 1, seq);
ADC_CR2(ADC1) |= ADC_CR2_ADON;
while (!adc_eoc(ADC1))
;
sum += adc_read_regular(ADC1);
}
return (uint16_t)(sum / samples);
}
static uint16_t loop_read(uint8_t channel)
{
return adc_read(channel, 8);
}
static uint16_t temp_read(void)
{
return loop_read(3);
}
static uint16_t cputemp_read(void)
{
return loop_read(16);
}
static uint16_t light_read(void)
{
return loop_read(2);
}
static uint16_t soil_read(void)
{
return loop_read(1);
}
static int print_int(int value, char *str)
{
int8_t i;
uint8_t nr_digits = 0;
char local_buffer[25];
char *buffer;
int x = 1000 * 1000 * 1000;
int started = 0;
if (str)
buffer = str;
else
buffer = local_buffer;
if (value < 0) {
buffer[0] = '-';
value = value * -1;
nr_digits++;
}
while (1) {
if (started || (x == 1) || ((value / x) > 0)) {
buffer[nr_digits++] = '0' + value / x;
started = 1;
}
if (x == 1)
break;
value %= x;
x /= 10;
}
buffer[nr_digits] = '\0';
if (str == NULL)
usart1_puts(buffer);
return nr_digits;
}
void main(void) {
volatile int button_channel = 0;
uint32_t start_pressed = 0;
uint32_t switchtime = 0;
uint16_t light, temp= 0, soil = 0, cputemp;
int i;
char str[100];
rcc_clock_setup_in_hse_8mhz_out_72mhz();
//button_setup();
//button_start_read();
adc_setup();
usart1_init();
tft_init();
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO0 | GPIO1);
gpio_set(GPIOB, GPIO0 | GPIO1);
usart1_puts("\e[2J"); // clear screen on terminal
usart1_puts("\e[0;0H"); // home cursor
gpio_clear(GPIOB, GPIO0);
while(1) {
uint32_t temp_integer = 0;
uint32_t temp_fractions = 0;
int half_degree = 0;
char tmp_text[10];
int tlen = 0;
uint16_t light_percent, soil_percent;
temp = temp_read();
temp_integer = (temp * 330);
temp_fractions = temp_integer % 4096;
temp_integer >>= 12;
if (temp_fractions > 1024 && temp_fractions < 3072)
half_degree = 1;
if (temp_fractions >= 3072)
temp_integer++;
soil = soil_read();
light = light_read();
usart1_puts("Temperature: ");
print_int(temp_integer, NULL);
if (half_degree)
usart1_puts(".5");
/* Temperature on screen */
fill_area(BGCOLOR, 260, 40, 60, 20);
text_at(0, 120, 40, "Temperature ");
tlen = print_int(temp_integer, tmp_text);
text_at(0, 260, 40, tmp_text);
if (half_degree)
text_at(0, 260 + 8 * tlen, 40, ".5");
usart1_puts(", Light: ");
print_int(light, NULL);
light_percent = (100 * light) >> 12;
fill_area(BGCOLOR, 260, 70, 60, 20);
text_at(0, 120, 70, "Light exposure ");
tlen = print_int(light_percent, tmp_text);
text_at(0, 260, 70, tmp_text);
text_at(0, 280, 70, "/100");
usart1_puts(", Soil: ");
print_int(soil, NULL);
usart1_puts("\r\n");
soil_percent = (100 * soil) >> 12;
fill_area(BGCOLOR, 260, 100, 60, 20);
text_at(0, 120, 100, "Soil moisture ");
tlen = print_int(soil_percent, tmp_text);
text_at(0, 260, 100, tmp_text);
text_at(0, 280, 100, "/100");
for (i = 0; i < 1440000; i++)
;
gpio_toggle(GPIOB, GPIO1);
if (button_press_pending) {
button_press_pending = 0;
}
}
}

13
openocd.cfg Normal file
View file

@ -0,0 +1,13 @@
#daemon configuration
telnet_port 4444
gdb_port 3333
interface jlink
transport select jtag
jtag_rclk 8
#adapter_khz 1000
reset_config trst_and_srst
#jtag newtap auto0 tap -irlen 4 -expected-id 0x3ba00477
#jtag newtap auto1 tap -irlen 5 -expected-id 0x06414041
#transport select swd
source [find target/stm32f1x.cfg]

195
startup.c Normal file
View file

@ -0,0 +1,195 @@
/* (c) Daniele Lacamera 2019
* GPL
*/
extern unsigned int _stored_data;
extern unsigned int _start_data;
extern unsigned int _end_data;
extern unsigned int _start_bss;
extern unsigned int _end_bss;
extern unsigned int _end_stack;
extern unsigned int _start_heap;
static int zeroed_variable_in_bss;
static int initialized_variable_in_data = 42;
//#define STACK_PAINTING
static volatile unsigned int avail_mem = 0;
static unsigned int sp;
extern void main(void);
extern void isr_tim2(void);
extern void isr_exti15_10(void);
extern void isr_exti2(void);
void isr_reset(void) {
register unsigned int *src, *dst;
src = (unsigned int *) &_stored_data;
dst = (unsigned int *) &_start_data;
while (dst < (unsigned int *)&_end_data) {
*dst = *src;
dst++;
src++;
}
dst = &_start_bss;
while (dst < (unsigned int *)&_end_bss) {
*dst = 0U;
dst++;
}
avail_mem = &_end_stack - &_start_heap;
main();
}
void isr_fault(void)
{
/* Panic. */
while(1) ;;
}
void isr_memfault(void)
{
/* Panic. */
while(1) ;;
}
void isr_busfault(void)
{
/* Panic. */
while(1) ;;
}
void isr_usagefault(void)
{
/* Panic. */
while(1) ;;
}
void isr_empty(void)
{
while(1);
}
__attribute__ ((section(".isr_vector")))
void (* const IV[])(void) =
{
(void (*)(void))(&_end_stack),
isr_reset, // Reset
isr_fault, // NMI
isr_fault, // HardFault
isr_memfault, // MemFault
isr_busfault, // BusFault
isr_usagefault, // UsageFault
0, 0, 0, 0, // 4x reserved
isr_empty, // SVC
isr_empty, // DebugMonitor
0, // reserved
isr_empty, // PendSV
isr_empty, // SysTick
/* F7 Specific */
isr_empty, // nvic_wwdg_isr(void);
isr_empty, // pvd_isr(void);
isr_empty, // tamp_stamp_isr(void);
isr_empty, // rtc_wkup_isr(void);
isr_empty, // flash_isr(void);
isr_empty, // rcc_isr(void);
isr_empty, // exti0_isr(void);
isr_empty, // exti1_isr(void);
isr_exti2, // exti2_isr(void);
isr_empty, // exti3_isr(void);
isr_empty, // exti4_isr(void);
isr_empty, // dma1_stream0_isr(void);
isr_empty, // dma1_stream1_isr(void);
isr_empty, // dma1_stream2_isr(void);
isr_empty, // dma1_stream3_isr(void);
isr_empty, // dma1_stream4_isr(void);
isr_empty, // dma1_stream5_isr(void);
isr_empty, // dma1_stream6_isr(void);
isr_empty, // adc_isr(void);
isr_empty, // can1_tx_isr(void);
isr_empty, // can1_rx0_isr(void);
isr_empty, // can1_rx1_isr(void);
isr_empty, // can1_sce_isr(void);
isr_empty, // exti9_5_isr(void);
isr_empty, // tim1_brk_tim9_isr(void);
isr_empty, // tim1_up_tim10_isr(void);
isr_empty, // tim1_trg_com_tim11_isr(void);
isr_empty, // tim1_cc_isr(void);
isr_empty, // tim2_isr(void);
isr_empty, // tim3_isr(void);
isr_empty, // tim4_isr(void);
isr_empty, // i2c1_ev_isr(void);
isr_empty, // i2c1_er_isr(void);
isr_empty, // i2c2_ev_isr(void);
isr_empty, // i2c2_er_isr(void);
isr_empty, // spi1_isr(void);
isr_empty, // spi2_isr(void);
isr_empty, // usart1_isr(void);
isr_empty, // usart2_isr(void);
isr_empty, // usart3_isr(void);
isr_exti15_10, // exti15_10_isr(void);
isr_empty, // rtc_alarm_isr(void);
isr_empty, // usb_fs_wkup_isr(void);
isr_empty, // tim8_brk_tim12_isr(void);
isr_empty, // tim8_up_tim13_isr(void);
isr_empty, // tim8_trg_com_tim14_isr(void);
isr_empty, // tim8_cc_isr(void);
isr_empty, // dma1_stream7_isr(void);
isr_empty, // fsmc_isr(void);
isr_empty, // sdmmc1_isr(void);
isr_empty, // tim5_isr(void);
isr_empty, // spi3_isr(void);
isr_empty, // uart4_isr(void);
isr_empty, // uart5_isr(void);
isr_empty, // tim6_dac_isr(void);
isr_empty, // tim7_isr(void);
isr_empty, // dma2_stream0_isr(void);
isr_empty, // dma2_stream1_isr(void);
isr_empty, // dma2_stream2_isr(void);
isr_empty, // dma2_stream3_isr(void);
isr_empty, // dma2_stream4_isr(void);
isr_empty, // eth_isr(void);
isr_empty, // eth_wkup_isr(void);
isr_empty, // can2_tx_isr(void);
isr_empty, // can2_rx0_isr(void);
isr_empty, // can2_rx1_isr(void);
isr_empty, // can2_sce_isr(void);
isr_empty, // otg_fs_isr(void);
isr_empty, // dma2_stream5_isr(void);
isr_empty, // dma2_stream6_isr(void);
isr_empty, // dma2_stream7_isr(void);
isr_empty, // usart6_isr(void);
isr_empty, // i2c3_ev_isr(void);
isr_empty, // i2c3_er_isr(void);
isr_empty, // otg_hs_ep1_out_isr(void);
isr_empty, // otg_hs_ep1_in_isr(void);
isr_empty, // otg_hs_wkup_isr(void);
isr_empty, // otg_hs_isr(void);
isr_empty, // dcmi_isr(void);
isr_empty, // cryp_isr(void);
isr_empty, // hash_rng_isr(void);
isr_empty, // fpu_isr(void);
isr_empty, // uart7_isr(void);
isr_empty, // uart8_isr(void);
isr_empty, // spi4_isr(void);
isr_empty, // spi5_isr(void);
isr_empty, // spi6_isr(void);
isr_empty, // sai1_isr(void);
isr_empty, // lcd_tft_isr(void);
isr_empty, // lcd_tft_err_isr(void);
isr_empty, // dma2d_isr(void);
isr_empty, // sai2_isr(void);
isr_empty, // quadspi_isr(void);
isr_empty, // i2c4_ev_isr(void);
isr_empty, // i2c4_er_isr(void);
isr_empty, // spdifrx_isr(void);
};

29
system.c Normal file
View file

@ -0,0 +1,29 @@
/* (c) Daniele Lacamera 2019
* GPL
*/
#include <stdint.h>
#include "system.h"
#include <string.h>
extern uint32_t cpu_freq;
void *memset(void *s, int c, size_t n)
{
unsigned char *d = (unsigned char *)s;
while (n--) {
*d++ = (unsigned char)c;
}
return s;
}
size_t strlen(const char *s)
{
int i = 0;
while (s[i] != 0)
i++;
return i;
}

80
system.h Normal file
View file

@ -0,0 +1,80 @@
#ifndef SYSTEM_H_INCLUDED
#define SYSTEM_H_INCLUDED
#include <stdint.h>
/* System specific: PLL with 8 MHz external oscillator, CPU at 168MHz */
#define CPU_FREQ (48000000)
#define PLL_FULL_MASK (0x7F037FFF)
/* STM32 specific defines */
#define APB1_CLOCK_ER (*(volatile uint32_t *)(0x40023840))
#define APB1_CLOCK_RST (*(volatile uint32_t *)(0x40023820))
#define TIM2_APB1_CLOCK_ER_VAL (1 << 0)
#define PWR_APB1_CLOCK_ER_VAL (1 << 28)
#define APB2_CLOCK_ER (*(volatile uint32_t *)(0x40023844))
#define APB2_CLOCK_RST (*(volatile uint32_t *)(0x40023824))
#define SYSCFG_APB2_CLOCK_ER (1 << 14)
/* SCB for sleep configuration */
#define SCB_SCR (*(volatile uint32_t *)(0xE000ED10))
#define SCB_SCR_SEVONPEND (1 << 4)
#define SCB_SCR_SLEEPDEEP (1 << 2)
#define SCB_SCR_SLEEPONEXIT (1 << 1)
/* Assembly helpers */
#define DMB() __asm__ volatile ("dmb")
#define WFI() __asm__ volatile ("wfi")
#define WFE() __asm__ volatile ("wfe")
#define SEV() __asm__ volatile ("sev")
/* Master clock setting */
void clock_pll_on(int powersave);
void clock_pll_off(void);
/* NVIC */
/* NVIC ISER Base register (Cortex-M) */
#define NVIC_EXTI0_IRQN (6)
#define NVIC_EXTI1_IRQN (7)
#define NVIC_EXTI2_IRQN (8)
#define NVIC_EXTI3_IRQN (9)
#define NVIC_EXTI4_IRQN (10)
#define NVIC_TIM2_IRQN (28)
#define NVIC_ISER_BASE (0xE000E100)
#define NVIC_ICER_BASE (0xE000E180)
#define NVIC_ICPR_BASE (0xE000E280)
#define NVIC_IPRI_BASE (0xE000E400)
static inline void nvic_irq_enable(uint8_t n)
{
int i = n / 32;
volatile uint32_t *nvic_iser = ((volatile uint32_t *)(NVIC_ISER_BASE + 4 * i));
*nvic_iser |= (1 << (n % 32));
}
static inline void nvic_irq_disable(uint8_t n)
{
int i = n / 32;
volatile uint32_t *nvic_icer = ((volatile uint32_t *)(NVIC_ICER_BASE + 4 * i));
*nvic_icer |= (1 << (n % 32));
}
static inline void nvic_irq_setprio(uint8_t n, uint8_t prio)
{
volatile uint8_t *nvic_ipri = ((volatile uint8_t *)(NVIC_IPRI_BASE + n));
*nvic_ipri = prio;
}
static inline void nvic_irq_clear(uint8_t n)
{
int i = n / 32;
volatile uint8_t *nvic_icpr = ((volatile uint8_t *)(NVIC_ICPR_BASE + 4 * i));
*nvic_icpr = (1 << (n % 32));
}
#endif

41
target-f103.ld Normal file
View file

@ -0,0 +1,41 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
}
SECTIONS
{
.text :
{
_start_text = .;
KEEP(*(.isr_vector))
*(.text*)
*(.rodata*)
. = ALIGN(4);
_end_text = .;
} > FLASH
_stored_data = .;
.data : AT (_stored_data)
{
_start_data = .;
*(.data*)
. = ALIGN(4);
_end_data = .;
} > SRAM
.bss :
{
_start_bss = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
_end_bss = .;
_end = .;
} > SRAM
}
PROVIDE(_end_stack = ORIGIN(SRAM) + LENGTH(SRAM));
PROVIDE(_start_heap = _end);

1
unicore-mx Submodule

@ -0,0 +1 @@
Subproject commit e55016bea87360a3056b093d23ff7bc497fba4d7

50
usart.c Normal file
View file

@ -0,0 +1,50 @@
/* (c) Daniele Lacamera 2019
* GPL
*/
#include <unicore-mx/stm32/rcc.h>
#include <unicore-mx/stm32/gpio.h>
#include <unicore-mx/stm32/usart.h>
void usart1_puts(char *s) {
while(*s) {
usart_send_blocking(USART1, *s);
s++;
}
return;
}
uint8_t usart1_getc(void) {
return usart_recv_blocking(USART1);
}
void usart1_putc(uint8_t c) {
usart_send_blocking(USART1, c);
return;
}
void usart1_init(void) {
/* enable clock, USART1 is on GPIOA */
rcc_periph_clock_enable(RCC_GPIOA);
rcc_periph_clock_enable(RCC_USART1);
/* setup TX pin (PA9) */
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO9);
/* setup RX pin (PA10) */
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO10);
/* Setup USART parameters. */
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX_RX);
usart_set_parity(USART1, USART_PARITY_NONE);
usart_set_flow_control(USART1, USART_FLOWCONTROL_NONE);
/* enable USART */
usart_enable(USART1);
return;
}