2 * FreeRTOS Kernel V10.1.0
\r
3 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://www.FreeRTOS.org
\r
23 * http://aws.amazon.com/freertos
\r
25 * 1 tab == 4 spaces!
\r
31 * Author Jefferson L Smith, Robotronics Inc.
\r
33 * __premain() is the startup code to init hardware and ram to execute the
\r
38 #include <sys/ports.h>
\r
41 void ATTR_NEAR __premain (void);
\r
46 // in case special mode enabled, avoid conflict on PORTE
\r
48 // bgnd mode stops COP and RTI clocks
\r
50 // stops TCNT counter when debugging stops
\r
51 TSCR1 |= (1<<5); // TFRZ
\r
54 CLKSEL = 0; // disable PLL to configure
\r
55 // xtal 16MHz, bus 24MHz
\r
58 while (!(CRGFLG & 0x08)) // wait for PLL LOCK
\r
59 cop_optional_reset();
\r
60 CLKSEL |= 0x80; // use PLL
\r
62 // init switch inputs
\r
63 PERH = 0xff; // pullups
\r
66 #if PORT_LED==M6811_PORTB //PORTB
\r
67 DDRB = 0xff; // init LED
\r
68 #elif PORT_LED==M6811_PORTA //PORTA
\r
70 #elif PORT_LED==M6811_PTT //PTT
\r
72 #elif PORT_LED==M6811_PTM //PTM
\r
74 #elif PORT_LED==M6811_PTP //PTP
\r
76 #elif PORT_LED==M6811_PTH //PTH
\r