1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-20 23:05:09 +03:00

Now bootloader OK on Taranis

This commit is contained in:
bsongis 2014-03-12 16:06:13 +01:00
parent 4e6def3ba3
commit 68c270760c
9 changed files with 123 additions and 151 deletions

View file

@ -1097,14 +1097,16 @@ all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library.
ifeq ($(ARCH), AVR)
build: stamp_header tra lbm allsrc.cpp elf remallsrc hex
else
else ifeq ($(PCB), TARANIS)
build: stamp_header tra lbm bootloader.lbm allsrc.cpp elf remallsrc bin
else
build: stamp_header tra lbm allsrc.cpp elf remallsrc bin
endif
# build bootloader
.PHONY bootloader.lbm:
@echo "Building bootloader..."
$(MAKE) -C bootloader PCB=TARANIS
$(MAKE) -C bootloader PCB=$(PCB) PCBREV=$(PCBREV)
$(BIN2LBM) bootloader.lbm bootloader/bootloader_ramBoot.bin
tra: translations/en.h translations/cz.h translations/de.h translations/es.h translations/fi.h translations/fr.h translations/it.h translations/pl.h translations/pt.h translations/se.h

View file

@ -70,6 +70,9 @@ RUN_FROM_FLASH = 0
endif
endif
# PCB revision
PCBREV =
EXTRAINCDIRS =
#
@ -90,6 +93,14 @@ ifeq ($(RUN_FROM_FLASH), 1)
TRGT = arm-none-eabi-
CPPDEFS += -DPCBSKY
UDEFS = -Dat91sam3s8
# If REVX board
ifeq ($(REVX), 1)
CPPDEFS += -DREVX
endif
CPPDEFS += -DREVB
else
ifeq ($(PCB), TARANIS)
ARCH = ARM
@ -105,6 +116,15 @@ else
EXTRAINCDIRS += ../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc
EXTRAINCDIRS += ../targets/taranis
EXTRAINCDIRS += ../fonts/std
ifeq ($(PCBREV), REV3)
CPPDEFS += -DREV3
else ifeq ($(PCBREV), REV4a)
CPPDEFS += -DREV4a
else
CPPDEFS += -DREV4
endif
endif
endif
@ -240,16 +260,9 @@ COBJS = $(patsubst %,$(OBJDIR)/%,$(notdir $(CXOBJS) ))
CPPOBJS = $(patsubst %,$(OBJDIR)/%,$(notdir $(CPPXOBJS) ))
DIRS = $(sort $(dir $(AXOBJS) $(CXOBJS) $(CPPXOBJS) ) )
# If REVX board
ifeq ($(REVX), 1)
CPPDEFS += -DREVX
EXT_MOD=REVB-X
endif
CPPDEFS += -DCPUARM
CPPDEFS += -DREVB
# If serial Debug required
ifeq ($(DEBUG), 1)
CPPDEFS += -DDEBUG

View file

@ -111,7 +111,6 @@ volatile uint8_t Tenms ;
uint8_t EE_timer ;
TCHAR FlashFilename[60] ;
FATFS g_FATFS ;
FIL FlashFile ;
DIR Dj ;
FILINFO Finfo ;
@ -774,7 +773,6 @@ extern uint8_t OptrexDisplay ;
#ifdef PCBTARANIS
// SD card detect pin
// configure_pins( SD_PRESENT_GPIO_Pin, PIN_PORTD | PIN_INPUT | PIN_PULLUP ) ;
disk_initialize( 0 ) ;
sdInit() ;
unlockFlash() ;
@ -804,23 +802,12 @@ extern uint8_t OptrexDisplay ;
}
}
Tenms = 0 ;
lcd_clear() ;
#ifdef PCBSKY
lcd_putsLeft( 0, "Boot Loader" ) ;
#endif
#ifdef PCBTARANIS
lcd_putsLeft( 0, "\006Boot Loader" ) ;
#endif
Tenms = 0;
lcd_clear();
lcd_putsLeft(0, CENTER "Boot Loader");
lcd_invert_line(0);
if ( sdMounted() )
{
#ifdef PCBSKY
lcd_putsLeft( 0, "\014Ready" ) ;
#endif
#ifdef PCBTARANIS
lcd_putsLeft( 0, "\022Ready" ) ;
#endif
if ( usbPlugged() )
{
@ -849,7 +836,8 @@ extern uint8_t OptrexDisplay ;
if ( state == ST_START )
{
fr = f_mount(0, &g_FATFS) ;
sdInit();
fr = FR_OK;
}
else
{
@ -865,7 +853,7 @@ extern uint8_t OptrexDisplay ;
}
if ( state == ST_DIR_CHECK )
{
fr = f_chdir( (TCHAR *)"\\firmware" ) ;
fr = f_chdir("/firmware") ;
if ( fr == FR_OK )
{
state = ST_OPEN_DIR ;
@ -875,15 +863,15 @@ extern uint8_t OptrexDisplay ;
if ( state == ST_DIR_CHECK )
{
#ifdef PCBSKY
lcd_putsLeft( 16, "\005No Firmware" ) ;
lcd_putsLeft( 2*FH, "\005No Firmware" ) ;
#endif
#ifdef PCBTARANIS
lcd_putsLeft( 16, "\013No Firmware" ) ;
lcd_putsLeft( 2*FH, "\013No Firmware" ) ;
#endif
}
if ( state == ST_OPEN_DIR )
{
fr = f_opendir( &Dj, (TCHAR *) "." ) ;
fr = f_opendir(&Dj, ".") ;
if ( fr == FR_OK )
{
state = ST_FILE_LIST ;
@ -984,7 +972,7 @@ extern uint8_t OptrexDisplay ;
state = ST_REBOOT ;
}
}
lcd_invert_line(2*FH+FH*vpos);
lcd_invert_line(2+vpos);
// lcd_char_inverse( 0, 2*FH+FH*vpos, DISPLAY_CHAR_WIDTH*FW, 0 ) ;
}
if ( state == ST_FLASH_CHECK )
@ -1061,27 +1049,19 @@ extern uint8_t OptrexDisplay ;
}
}
#ifdef PCBTARANIS
if ( --TenCount == 0 )
{
if ( --TenCount == 0 ) {
TenCount = 2 ;
#endif
lcdRefresh() ;
#ifdef PCBTARANIS
}
#endif
if ( PowerUpDelay < 20 ) // 200 mS
{
PowerUpDelay += 1 ;
}
else
{
#ifdef PCBSKY
sd_poll_10mS() ;
#endif
#ifdef PCBTARANIS
sdPoll10ms() ;
#endif
}
}
if ((state < ST_FLASH_CHECK) || (state == ST_FLASH_DONE))
@ -1110,7 +1090,6 @@ extern uint8_t OptrexDisplay ;
}
}
// stop_timer0() ;
return 0;
}

View file

@ -432,12 +432,8 @@ void menuGeneralSetup(uint8_t event)
case ITEM_SETUP_CONTRAST:
lcd_putsLeft(y, STR_CONTRAST);
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT);
if(attr) {
#if defined(PCBTARANIS)
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, 0, 45);
#else
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, 10, 45);
#endif
if (attr) {
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, CONTRAST_MIN, CONTRAST_MAX);
lcdSetContrast();
}
break;
@ -602,23 +598,15 @@ void menuGeneralSetup(uint8_t event)
#if defined(MAVLINK)
case ITEM_MAVLINK_BAUD:
g_eeGeneral.mavbaud = selectMenuItem(RADIO_SETUP_2ND_COLUMN, //Y
y, // Y
STR_MAVLINK_BAUD_LABEL, // pm_char *label
STR_MAVLINK_BAUDS, // pm_char *values
// PSTR("4800""9600""14400""19200""38400""57600""76800""115200"),
g_eeGeneral.mavbaud, // value
0, // min
7, // max
attr, // attr
event); // event
g_eeGeneral.mavbaud = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUD_LABEL, STR_MAVLINK_BAUDS, PSTR("4800""9600""14400""19200""38400""57600""76800""115200"), g_eeGeneral.mavbaud, 0, 7, attr, event);
break;
#endif
case ITEM_SETUP_RX_CHANNEL_ORD:
lcd_putsLeft(y, STR_RXCHANNELORD); // RAET->AETR
for (uint8_t i=1; i<=4; i++)
for (uint8_t i=1; i<=4; i++) {
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr);
}
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23);
break;
@ -629,7 +617,9 @@ void menuGeneralSetup(uint8_t event)
case ITEM_SETUP_STICK_MODE:
lcd_putcAtt(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
for (uint8_t i=0; i<4; i++) putsMixerSource((6+4*i)*FW, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
for (uint8_t i=0; i<4; i++) {
putsMixerSource((6+4*i)*FW, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
}
if (attr && s_editMode>0) {
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickMode, 0, 3);
}

View file

@ -43,12 +43,16 @@
#define xcoord_t uint16_t
#define CENTER "\015"
#define CENTER_OFS (7*FW-FW/2)
#define CONTRAST_MIN 0
#define CONTRAST_MAX 45
#else
#define LCD_W 128
#define LCD_H 64
#define xcoord_t uint8_t
#define CENTER
#define CENTER_OFS 0
#define CONTRAST_MIN 10
#define CONTRAST_MAX 45
#endif
#if defined(CPUARM)

View file

@ -232,7 +232,7 @@ void SystemInit(void)
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
#if defined(BOOTLOADER)
#if defined(BOOTLOADER) || defined(BOOT)
extern uint32_t g_pfnVectors ;
SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */
#else

View file

@ -670,33 +670,6 @@ int8_t SD_ReadSectors(uint8_t *buff, uint32_t sector, uint32_t count)
{
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
do {
if (!rcvr_datablock(buff, 512)) {
break;
}
buff += 512;
} while (--count);
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
}
release_spi();
return 0;
}
DRESULT disk_read (
BYTE drv, /* Physical drive number (0) */
BYTE *buff, /* Pointer to the data buffer to store read data */
DWORD sector, /* Start sector number (LBA) */
BYTE count /* Sector count (1..255) */
)
{
if (drv || !count) return RES_PARERR;
if (Stat & STA_NOINIT) return RES_NOTRDY;
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
if (count == 1) { /* Single block read */
if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */
if (rcvr_datablock(buff, 512)) {
@ -715,9 +688,25 @@ DRESULT disk_read (
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
}
}
release_spi();
return count ? RES_ERROR : RES_OK;
return 0;
}
DRESULT disk_read (
BYTE drv, /* Physical drive number (0) */
BYTE *buff, /* Pointer to the data buffer to store read data */
DWORD sector, /* Start sector number (LBA) */
BYTE count /* Sector count (1..255) */
)
{
if (drv || !count) return RES_PARERR;
if (Stat & STA_NOINIT) return RES_NOTRDY;
SD_ReadSectors(buff, sector, count);
return RES_OK;
}

View file

@ -22,9 +22,9 @@ static void LCD_Init()
AspiCmd(0xEA); //set bias=1/10 :Command table NO.27
AspiCmd(0x81); //Set Vop
#if defined(BOOT)
AspiCmd(CONTRAST_OFS);
AspiCmd(CONTRAST_OFS+25);
#else
AspiCmd(g_eeGeneral.contrast+CONTRAST_OFS); //0--255
AspiCmd(CONTRAST_OFS+g_eeGeneral.contrast);
#endif
AspiCmd(0xA6); //inverse display off
AspiCmd(0xD1); //SET RGB:Command table NO.21 .SET RGB or BGR. D1=RGB

View file

@ -203,14 +203,11 @@ int8_t STORAGE_Read (uint8_t lun,
uint16_t blk_len)
{
if (lun == 1) {
if (fat12Read(buf, blk_addr, blk_len) != 0) {
if (fat12Read(buf, blk_addr, blk_len) != 0)
return -1;
}
}
else {
if (SD_ReadSectors(buf,
blk_addr,
blk_len) != 0) {
if (SD_ReadSectors(buf, blk_addr, blk_len) != 0) {
return -1;
}
}
@ -238,9 +235,7 @@ int8_t STORAGE_Write (uint8_t lun,
return -1;
}
else {
if (SD_WriteSectors(buf,
blk_addr,
blk_len) != 0)
if (SD_WriteSectors(buf, blk_addr, blk_len) != 0)
return -1;
}