1 | /*
|
2 | * Visonik.c
|
3 | *
|
4 | * Created: 20.11.2011 20:10:57
|
5 | * Author: Bastel
|
6 | */
|
7 | //#define in Project Properties Symbols -D F_CPU=18432000UL Compiler Optimization auf -O1 für Delay --> siehe Text in Delay Debug max -g3 ???
|
8 | //-Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x8030ff
|
9 | #include <stdlib.h>
|
10 | #include <stdio.h>
|
11 | #include <avr/io.h>
|
12 | #include "IO_Vis.h"
|
13 |
|
14 | void init_extSRAM(void) __attribute__((used,naked,section(".init3"))) ;
|
15 | void init_extSRAM(void) {
|
16 | //Enable external SRAM: set MCUCR, XMCRA and XMCRB for
|
17 | // External SRAM page configuration: 1100h - FFFFh
|
18 | // Lower page wait state(s): None
|
19 | // Upper page wait state(s): None
|
20 | MCUCR |= (1<<SRE); //
|
21 | XMCRA=0x00; //Waitstate
|
22 | XMCRB=0x00 ; //Set Bit Mask for not use Address IO Pins
|
23 | }
|
24 |
|
25 | char buf[40];
|
26 | volatile unsigned long test_F_CPU;
|
27 |
|
28 | #define UDRE 5
|
29 | #define TXC 6
|
30 | #define DATA_REGISTER_EMPTY (1<<UDRE)
|
31 | #define TX_COMPLETE (1<<TXC)
|
32 |
|
33 | /* putchar function */
|
34 | void uputchar(char c)
|
35 | {
|
36 | while ((UCSR1A & DATA_REGISTER_EMPTY)==0);
|
37 | UDR1=c;
|
38 | while ((UCSR1A & TX_COMPLETE)==0);
|
39 | }
|
40 |
|
41 | void uputstr( char *str )
|
42 | {
|
43 | while (*str != 0) {
|
44 | uputchar( *str++ );
|
45 | }
|
46 | }
|
47 |
|
48 | int main(void)
|
49 | { //test_F_CPU = F_CPU;
|
50 | int *data;
|
51 | int ndata=61183; //size of Data array
|
52 | if ( (data = (int *)malloc(ndata *sizeof(int)) ) == NULL )
|
53 | {
|
54 | sprintf(buf,"Unable to allocate data array\r\n"); uputstr(buf);
|
55 | }
|
56 | else
|
57 | {
|
58 | sprintf(buf,"Successfully alocated data array\r\n"); uputstr(buf);
|
59 | }
|
60 | // XMem = malloc(0x80ffff-0x801100);
|
61 | while(1)
|
62 | {
|
63 | //TODO:: Please write your application code
|
64 | }
|
65 | }
|