PIC 18f452 Hilfe Bei 1. C programm mit sdcc

Gast #2680061
Lesenswert?

Hallo,
Ich versuche gerade mein erstes C Programm für einen PIC 18F452 zu 
schreiben, zu compilieren und mit Mplab zu simulieren.

Hier das C-Coding:
1
//Erstes C Program fuer PIC 18f452
2
// version 1
3
// Compiler Aufruf:
4
//sdcc -mpic16 -p18f452 -D__18f452 --use-non-free "E:\Entwicklung\test1.c"
5

6
#include "pic18f452.h"
7

8
// Setup chip configuration
9
typedef unsigned int config;
10
config at 0x2007 __CONFIG = _OSC_HS_1H &
11
_PUT_ON_2L &
12
_BODEN_OFF_2L &
13
_WDT_OFF_2H &
14
_LVP_OFF_4L;
15

16
static unsigned char count;
17

18
void main(void)
19
{
20

21
        TRISD = 0x00;  // Setzt PORTD auf Ausgang
22
        
23
        count = 0x00;  // 
24

25
        while(1)  // 
26
        {
27
      PORTD = count; //Ausgabe von Count an Port D
28
      count ++;  
29
        }
30

31
}

Dann setze ich folgenden Compiler Aufruf ab:
sdcc -mpic16 -p18f452 -D__18f452 --use-non-free "E:\Entwicklung\test1.c"

Es kommt dann folgende Meldung:
message: using default linker script 
"C:\Programme\gputils\lkr\18f452.lkr"

Es werden .o, .asm, .cod, .hex generiert.

Die HEX datei importiere ich dann in MPLAB v8.60

Als debugger wähle ich MPLAB SIM und im watch fenster wähle ich PORTD 
mit Add SFR aus.

Dann Starte ich den simulator und im Output Fenster hagelt es Meldungen:

>>CORE-W0005: An Invalid Programming mode was selected. No Programming operation 
occurred
UART-W0005: Synchronous mode is not implemented in USART. Use 
Asynchronous mode only.
ADC-W0008: No stimulus file attached to ADRESL for A/D.
ADC-W0011: The Go/Done bit must not be set in the same cycle as the 
Enable bit.
CORE-W0005: An Invalid Programming mode was selected. No Programming 
operation occurred
UART-W0005: Synchronous mode is not implemented in USART. Use 
Asynchronous mode only.
CORE-W0005: An Invalid Programming mode was selected. No Programming 
operation occurred
UART-W0005: Synchronous mode is not implemented in USART. Use 
Asynchronous mode only.
CORE-W0005: An Invalid Programming mode was selected. No Programming 
operation occurred
UART-W0005: Synchronous mode is not implemented in USART. Use 
Asynchronous mode only.
CORE-W0005: An Invalid Programming mode was selected. No Programming 
operation occurred
UART-W0005: Synchronous mode is not implemented in USART. Use 
Asynchronous mode only.
CORE-W0005: An Invalid Programming mode was selected. No Programming 
operation occurred
UART-W0005: Synchronous mode is not implemented in USART. Use 
Asynchronous mode only.
CORE-W0005: An Invalid Programming mode was selected. No Programming 
operation occurred
UART-W0005: Synchronous mode is not implemented in USART. Use 
Asynchronous mode only.
CORE-W0005: An Invalid Programming mode was selected. No Programming 
operation occurred
UART-W0005: Synchronous mode is not implemented in USART. Use 
Asynchronous mode only.
CORE-W0015: Out of bounds Memory Access (at address 0x008000 on 0x000001 
bytes)<<


Stimmt mein Compiler/linker Aufruf nicht oder was mache ich falsch.

Hat jemand vielleicht ein PIC18F252 Grundgerüst?

Im Voraus schonmal vielen Dank.
Gast #2680510
Lesenswert?

Kostet der nicht Geld, ausser der Academic Version die schaltet aber 
später ein paar features ab. Ich kann leider jetzt noch nicht beurteilen 
ob diese Features von hoher Wichtigkeit sind.
Vielleicht sind das ja auch Einschränkungen die SDCC auch hat. 
Codeoptimierungen??

Wie ist denn eure Einschätzung hierzu?

Danke
#2681952
Lesenswert?

Die Aussagen von MC sind da etwas schwammig. Zunächst ist es die besagte 
Prozedurale Abstraktion. Die sorgt für einen kompakteren Code in dem 
sich wiederholende Codefragmente zusammengefasst werden.
Dann wird noch die Unterstützung des "Enhanced Instruction Set" 
deaktiviert. Da dürfte dann auch die Performance drunter leiden.

Allerdings schreibt Microchip auf seiner Hompage:
1
These compilers have no time or memory limitations, however most code optimizations will be restricted.
Weiß der Kuckuck was das bedeuten soll.

Bei den C30 und C32 ist das klarer: Hier steht nur die Optimierungsstufe 
"-O1" zur Verfügung, wodurch der erzeugte Code fast so groß wird wie bei 
"-O2" (optimize for speed) aber etwas langsamer als bei "-Os" (optimize 
for size).
Welche Optimierungen in den jeweiligen Stufen durchgeführt werden steht 
im User Manual des GCC.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren