Make bootload compile with latest avr-gcc

This commit is contained in:
optixx 2016-02-09 12:32:32 +01:00
parent a0e072da2a
commit cf41986ccc
6 changed files with 40 additions and 46 deletions

View File

@ -18,7 +18,6 @@
* ===================================================================================== * =====================================================================================
*/ */
#include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <util/delay.h> #include <util/delay.h>
#include <stdlib.h> #include <stdlib.h>
@ -35,7 +34,7 @@
extern usb_transaction_t usb_trans; extern usb_transaction_t usb_trans;
extern system_t system; extern system_t my_system;
extern const char *_rom[]; extern const char *_rom[];
extern const char _rom01[]; extern const char _rom01[];

View File

@ -23,7 +23,6 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <avr/io.h>
#include <avr/interrupt.h> /* for sei() */ #include <avr/interrupt.h> /* for sei() */
#include <avr/wdt.h> #include <avr/wdt.h>
@ -35,7 +34,7 @@
#include "sram.h" #include "sram.h"
#include "system.h" #include "system.h"
extern system_t system; extern system_t my_system;
void (*jump_to_app) (void) = 0x0000; void (*jump_to_app) (void) = 0x0000;
@ -45,7 +44,7 @@ void irq_init()
PCMSK3 |= (1 << PCINT27); PCMSK3 |= (1 << PCINT27);
PCICR |= (1 << PCIE3); PCICR |= (1 << PCIE3);
sei(); sei();
system.reset_irq = RESET_IRQ_ON; my_system.reset_irq = RESET_IRQ_ON;
} }
void irq_stop() void irq_stop()
@ -53,20 +52,20 @@ void irq_stop()
cli(); cli();
PCMSK3 &= ~(1 << PCINT27); PCMSK3 &= ~(1 << PCINT27);
sei(); sei();
system.reset_irq = RESET_IRQ_OFF; my_system.reset_irq = RESET_IRQ_OFF;
} }
void leave_application(void) void leave_application(void)
{ {
cli(); cli();
usbDeviceDisconnect(); usbDeviceDisconnect();
system.avr_reset_count++; my_system.avr_reset_count++;
wdt_enable(WDTO_15MS); wdt_enable(WDTO_15MS);
while (1); while (1);
} }
ISR(SIG_PIN_CHANGE3) ISR(PCINT3_vect)
{ {
if (snes_reset_test()) { if (snes_reset_test()) {
info_P(PSTR("Catch SNES reset button\n")); info_P(PSTR("Catch SNES reset button\n"));

View File

@ -20,7 +20,6 @@
#include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <util/delay.h> #include <util/delay.h>
#include <stdlib.h> #include <stdlib.h>
@ -54,7 +53,7 @@
#ifndef NO_DEBUG #ifndef NO_DEBUG
extern FILE uart_stdout; extern FILE uart_stdout;
#endif #endif
extern system_t system; extern system_t my_system;
uint8_t debug_level = (DEBUG | DEBUG_USB | DEBUG_CRC); uint8_t debug_level = (DEBUG | DEBUG_USB | DEBUG_CRC);

View File

@ -42,7 +42,7 @@
#include "system.h" #include "system.h"
extern system_t system; extern system_t my_system;
const char STR_ROM[] PROGMEM = "Rom"; const char STR_ROM[] PROGMEM = "Rom";
const char STR_RAM[] PROGMEM = "Sram"; const char STR_RAM[] PROGMEM = "Sram";
@ -219,7 +219,7 @@ enum cmds {
CMD_HELP CMD_HELP
}; };
uint8_t cmdlist[][CMD_HELP] PROGMEM = { const uint8_t cmdlist[][CMD_HELP] PROGMEM = {
{"DUMP"}, {"DUMP"},
{"DUMPVEC"}, {"DUMPVEC"},
{"DUMPHEADER"}, {"DUMPHEADER"},
@ -339,7 +339,7 @@ void shell_run(void)
} }
} else if (strcmp_P((char *) t, (PGM_P) cmdlist[CMD_DUMPVEC]) == 0) { } else if (strcmp_P((char *) t, (PGM_P) cmdlist[CMD_DUMPVEC]) == 0) {
uint16_t offset; uint16_t offset;
if (system.rom_mode == LOROM) if (my_system.rom_mode == LOROM)
offset = 0x8000; offset = 0x8000;
else else
offset = 0x0000; offset = 0x0000;
@ -359,7 +359,7 @@ void shell_run(void)
} else if (strcmp_P((char *) t, (PGM_P) cmdlist[CMD_DUMPHEADER]) == 0) { } else if (strcmp_P((char *) t, (PGM_P) cmdlist[CMD_DUMPHEADER]) == 0) {
if (system.rom_mode == LOROM) if (my_system.rom_mode == LOROM)
offset = 0x8000; offset = 0x8000;
else else
offset = 0x0000; offset = 0x0000;

View File

@ -21,7 +21,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <avr/io.h>
#include <util/delay.h> /* for _delay_ms() */ #include <util/delay.h> /* for _delay_ms() */
#include <avr/interrupt.h> #include <avr/interrupt.h>
@ -35,32 +34,32 @@
#include "requests.h" #include "requests.h"
#include "irq.h" #include "irq.h"
system_t system; system_t my_system;
void system_init(void) void system_init(void)
{ {
snes_reset_hi(); snes_reset_hi();
snes_reset_off(); snes_reset_off();
system.reset_line = RESET_OFF; my_system.reset_line = RESET_OFF;
snes_irq_hi(); snes_irq_hi();
snes_irq_off(); snes_irq_off();
system.irq_line = IRQ_OFF; my_system.irq_line = IRQ_OFF;
snes_wr_disable(); snes_wr_disable();
system.wr_line = WR_DISABLE; my_system.wr_line = WR_DISABLE;
avr_bus_active(); avr_bus_active();
system.bus_mode = MODE_AVR; my_system.bus_mode = MODE_AVR;
snes_lorom(); snes_lorom();
system.rom_mode = LOROM; my_system.rom_mode = LOROM;
system.snes_reset_count = 0; my_system.snes_reset_count = 0;
system.avr_reset_count = 0; my_system.avr_reset_count = 0;
system.reset_irq = RESET_IRQ_OFF; my_system.reset_irq = RESET_IRQ_OFF;
} }
@ -74,7 +73,7 @@ void system_send_snes_reset()
snes_reset_hi(); snes_reset_hi();
snes_reset_off(); snes_reset_off();
sei(); sei();
system.snes_reset_count++; my_system.snes_reset_count++;
} }
void system_send_snes_irq() void system_send_snes_irq()
@ -89,13 +88,13 @@ void system_send_snes_irq()
void system_snes_irq_off() void system_snes_irq_off()
{ {
snes_irq_off(); snes_irq_off();
system.irq_line = IRQ_OFF; my_system.irq_line = IRQ_OFF;
} }
void system_snes_irq_on() void system_snes_irq_on()
{ {
snes_irq_on(); snes_irq_on();
system.irq_line = IRQ_ON; my_system.irq_line = IRQ_ON;
} }
@ -103,27 +102,27 @@ void system_set_bus_avr()
{ {
avr_bus_active(); avr_bus_active();
info_P(PSTR("Activate AVR bus\n")); info_P(PSTR("Activate AVR bus\n"));
system.bus_mode = MODE_AVR; my_system.bus_mode = MODE_AVR;
} }
void system_set_wr_disable() void system_set_wr_disable()
{ {
snes_wr_disable(); snes_wr_disable();
system.wr_line = WR_DISABLE; my_system.wr_line = WR_DISABLE;
info_P(PSTR("Disable SNES WR\n")); info_P(PSTR("Disable SNES WR\n"));
} }
void system_set_wr_enable() void system_set_wr_enable()
{ {
snes_wr_enable(); snes_wr_enable();
system.wr_line = WR_ENABLE; my_system.wr_line = WR_ENABLE;
info_P(PSTR("Enable SNES WR\n")); info_P(PSTR("Enable SNES WR\n"));
} }
void system_set_bus_snes() void system_set_bus_snes()
{ {
snes_bus_active(); snes_bus_active();
system.bus_mode = MODE_SNES; my_system.bus_mode = MODE_SNES;
info_P(PSTR("Activate SNES bus\n")); info_P(PSTR("Activate SNES bus\n"));
} }
@ -131,11 +130,11 @@ void system_set_rom_mode(usb_transaction_t * usb_trans)
{ {
if (usb_trans->req_bank_size == 0x8000) { if (usb_trans->req_bank_size == 0x8000) {
snes_lorom(); snes_lorom();
system.rom_mode = LOROM; my_system.rom_mode = LOROM;
info_P(PSTR("Set SNES lorom \n")); info_P(PSTR("Set SNES lorom \n"));
} else { } else {
snes_hirom(); snes_hirom();
system.rom_mode = HIROM; my_system.rom_mode = HIROM;
info_P(PSTR("Set SNES hirom \n")); info_P(PSTR("Set SNES hirom \n"));
} }
} }
@ -143,7 +142,7 @@ void system_set_rom_mode(usb_transaction_t * usb_trans)
void system_set_rom_lorom() void system_set_rom_lorom()
{ {
snes_lorom(); snes_lorom();
system.rom_mode = LOROM; my_system.rom_mode = LOROM;
info_P(PSTR("Set SNES lorom \n")); info_P(PSTR("Set SNES lorom \n"));
} }
@ -151,7 +150,7 @@ void system_set_rom_lorom()
void system_set_rom_hirom() void system_set_rom_hirom()
{ {
snes_hirom(); snes_hirom();
system.rom_mode = HIROM; my_system.rom_mode = HIROM;
info_P(PSTR("Set SNES hirom \n")); info_P(PSTR("Set SNES hirom \n"));
} }
@ -181,13 +180,13 @@ char *system_status_rom(uint8_t val)
void system_status() void system_status()
{ {
info_P(PSTR("\nBus Mode %s\n"), system_status_bus(system.bus_mode)); info_P(PSTR("\nBus Mode %s\n"), system_status_bus(my_system.bus_mode));
info_P(PSTR("Rom Mode %s\n"), system_status_rom(system.rom_mode)); info_P(PSTR("Rom Mode %s\n"), system_status_rom(my_system.rom_mode));
info_P(PSTR("Reset Line %s\n"), info_P(PSTR("Reset Line %s\n"),
system_status_helper(system.reset_line)); system_status_helper(my_system.reset_line));
info_P(PSTR("IRQ Line %s\n"), system_status_helper(system.irq_line)); info_P(PSTR("IRQ Line %s\n"), system_status_helper(my_system.irq_line));
info_P(PSTR("WR Line %s\n"), system_status_helper(system.wr_line)); info_P(PSTR("WR Line %s\n"), system_status_helper(my_system.wr_line));
info_P(PSTR("Reset IRQ %s\n"), system_status_helper(system.reset_irq)); info_P(PSTR("Reset IRQ %s\n"), system_status_helper(my_system.reset_irq));
info_P(PSTR("SNES Reset 0x%02x\n"), system.snes_reset_count); info_P(PSTR("SNES Reset 0x%02x\n"), my_system.snes_reset_count);
info_P(PSTR("AVR Reset 0x%02x\n"), system.avr_reset_count); info_P(PSTR("AVR Reset 0x%02x\n"), my_system.avr_reset_count);
} }

View File

@ -24,7 +24,6 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <avr/io.h> #include <avr/io.h>
#include <avr/io.h>
#include <avr/interrupt.h> /* for sei() */ #include <avr/interrupt.h> /* for sei() */
#include "debug.h" #include "debug.h"
@ -53,8 +52,7 @@ extern uint8_t snes_reset_line;
uint16_t prescaler; uint16_t prescaler;
uint16_t volatile second; // count seconds uint16_t volatile second; // count seconds
ISR(TIMER1_COMPA_vect)
ISR(SIG_OUTPUT_COMPARE1A)
{ {