Read about our upcoming Code of Conduct on this issue

Commit f446f4a6 authored by hudson@andromeda.local's avatar hudson@andromeda.local
Browse files

550d magiclantern.fir works

--HG--
branch : 550d
parent 3e9f5d2fddac
......@@ -32,7 +32,7 @@
#include "version.h"
/** If CONFIG_EARLY_PORT is defined, only a few things will be enabled */
#undef CONFIG_EARLY_PORT
#define CONFIG_EARLY_PORT
/** These are called when new tasks are created */
void my_task_dispatch_hook( struct context ** );
......@@ -70,8 +70,7 @@ copy_and_restart( void )
{
zero_bss();
// Copy the firmware to somewhere in memory
// bss ends at 0x47750, so we'll use 0x50000
// Copy the firmware to somewhere safe in memory
const uint8_t * const firmware_start = (void*) ROMBASEADDR;
const uint32_t firmware_len = RELOCSIZE;
uint32_t * const new_image = (void*) RELOCADDR;
......@@ -79,26 +78,27 @@ copy_and_restart( void )
blob_memcpy( new_image, firmware_start, firmware_start + firmware_len );
/*
* in entry2() (0xff812a98) make this change to
* in entry2() (0xff010134) make this change to
* return to our code before calling cstart().
* This should be a "BL cstart" instruction.
*/
INSTR( 0xFF812AE8 ) = RET_INSTR;
INSTR( 0xFF01019C ) = RET_INSTR;
/*
* in cstart() (0xff810894) make these changes:
* in cstart() (0xff010ff4) make these changes:
* calls bzero(), then loads bs_end and calls
* create_init_task
*/
// Reserve memory after the BSS for our application
// should be a pointer to 0x4d458 or thereabouts
INSTR( 0xFF81093C ) = (uintptr_t) _bss_end;
INSTR( 0xFF01109C ) = (uintptr_t) _bss_end;
// Fix the calls to bzero32() and create_init_task()
FIXUP_BRANCH( 0xFF8108A4, bzero32 );
FIXUP_BRANCH( 0xFF81092C, create_init_task );
FIXUP_BRANCH( 0xFF011004, bzero32 );
FIXUP_BRANCH( 0xFF01108C, create_init_task );
// Set our init task to run instead of the firmware one
INSTR( 0xFF810948 ) = (uint32_t) my_init_task;
INSTR( 0xFF0110A8 ) = (uint32_t) my_init_task;
// Make sure that our self-modifying code clears the cache
clean_d_cache();
......
......@@ -6,7 +6,7 @@ RANLIB=$(ARM_PATH)/arm-elf-ranlib
LD=$(CC)
HOST_CC=gcc
HOST_CFLAGS=-g -O3 -W -Wall
VERSION=0.1.8
VERSION=0.1.9
all: magiclantern.fir
......@@ -14,13 +14,13 @@ all: magiclantern.fir
CONFIG_PYMITE = n
CONFIG_RELOC = n
CONFIG_TIMECODE = n
CONFIG_LUA = y
CONFIG_LUA = n
# 5D memory map
# DryOSmemory map
# RESTARTSTART is selected to be just above the end of the bss
#
ROMBASEADDR = 0xFF810000
RESTARTSTART = 0x00050000
ROMBASEADDR = 0xFF010000
RESTARTSTART = 0x0008B000
# Firmware file IDs
FIRMWARE_ID_5D = 0x80000218
......@@ -72,6 +72,7 @@ FLAGS=\
-Wp,-MMD,$(dir $@).$(notdir $@).d \
-Wp,-MT,$@ \
-nostdlib \
-mlong-calls \
-fomit-frame-pointer \
-fno-strict-aliasing \
-DCONFIG_MAGICLANTERN=1 \
......@@ -155,8 +156,10 @@ ML_OBJS-y = \
magiclantern.lds \
entry.o \
5d-hack.o \
stubs-5d2.204.o \
stubs-550d.108.o \
version.o \
NO=\
stdio.o \
config.o \
debug.o \
......@@ -392,7 +395,7 @@ dumper.elf: 5d2_dump.fir flasher.map
--offset 0x5ab8 \
--id $(FIRMWARE_ID) \
magiclantern.fir: autoexec.bin
magiclantern-5d.fir: autoexec.bin
$(call build,ASSEMBLE,./assemble_fw \
--output $@ \
--user $< \
......@@ -402,6 +405,24 @@ magiclantern.fir: autoexec.bin
--zero \
)
#
# Replace the start of the 550d firmware file with our own image
#
550d-flasher.bin: autoexec.bin
cp ../1.0.8/0270_108_updaters.bin $@
dd \
of=$@ \
if=$< \
bs=1 \
conv=notrunc \
oseek=288 \
magiclantern.fir: 550d-flasher.bin
../dumper/enc_upd550.py \
../1.0.8/e8kr7108.fir \
$< \
$@ \
dummy_data_head.bin:
perl -e 'print chr(0) x 24' > $@
......
......@@ -83,6 +83,7 @@ void
__attribute__((noreturn))
cstart( void )
{
#if 0
set_i_tcm( 0x40000006 );
set_control_reg( read_control_reg() | 0x10000 );
......@@ -104,6 +105,7 @@ cstart( void )
set_control_reg( read_control_reg() | 0xC000107D );
select_normal_vectors();
#endif
// Copy the copy-and-restart blob somewhere
// there is a bug in that we are 0x120 bytes off from
......
/** \file
* Entry points into the firmware image.
*
* These are the functions that we can call from our tasks
* in the Canon 1.0.8 firmware for the 550d.
*
* \todo Sort this file? Generate it from the IDA map?
*/
/*
* Copyright (C) 2010 Trammell Hudson <hudson+ml@osresearch.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
.text
#define NSTUB(addr,name) \
.global name; \
name = addr
NSTUB( ROMBASEADDR, firmware_entry )
/** These must be found first for any progress to be made */
NSTUB( 0xFF010ff4, cstart )
NSTUB( 0xFF44F8C0, bzero32 ) // called by cstart()
NSTUB( 0xFF018D1C, init_task ) // passed as arg to create_init_task, look for dmSetup
NSTUB( 0xFF017518, create_init_task )
/** Look for the normal printf strings */
NSTUB( 0xFF0673EC, DebugMsg )
/** Task dispatch hook hasn't moved in several versions */
NSTUB( 0x1938, task_dispatch_hook )
/** Find the additioanl version string in GUI_GetFirmVersion */
NSTUB( 0x15094, additional_version )
// Everything below here is not needed for the first boot
/** Camera interface? */
NSTUB( 0xC0220000, camera_engine )
#if 0
/** Find the shell register commands */
NSTUB( 0xFF81C4DC, register_func )
/** Debugging commands are all registered by name. Search for the strings */
NSTUB( 0xFF86AEC8, dmstart )
NSTUB( 0xFF86B7DC, dumpf )
/** Look in DebugMsg, near the bottom. It calls vsnprintf()
* with a buffer size of 0x4C.
*/
NSTUB( 0xFF9B7164, vsnprintf )
NSTUB( 0xFF86E210, msleep )
NSTUB( 0xFF86E2C8, task_create )
NSTUB( 0xFF86AF08, dmstop )
NSTUB( 0xFF9AA9FC, FIO_Open)
NSTUB( 0xFF9AAAB0, FIO_CreateFile )
NSTUB( 0xFF9AAB58, FIO_CloseFile )
NSTUB( 0xFF9AB14C, FIO_GetFileSize )
NSTUB( 0xFF9AAF98, FIO_WriteFile )
NSTUB( 0xFF9AADE8, FIO_ReadFile )
NSTUB( 0xFF86DE54, give_semaphore )
NSTUB( 0xFF86DD6C, take_semaphore )
NSTUB( 0xFF86BCC4, call )
NSTUB( 0xFF86B294, dm_set_store_level )
NSTUB( 0xFF85F0D4, prop_register_slave )
NSTUB( 0xFF85F20C, prop_request_change )
NSTUB( 0xFF85F04C, prop_deliver )
NSTUB( 0xFF85F1A8, prop_cleanup )
NSTUB( 0xFF86DC0C, create_named_semaphore )
NSTUB( 0xFFA6BD14, gui_task_create )
NSTUB( 0xFF8696BC, LoadCalendarFromRTC )
NSTUB( 0xFF86F150, malloc )
NSTUB( 0xFF86F4E0, free )
NSTUB( 0xFF812E44, cli_save )
NSTUB( 0xFF812E58, sei_restore )
NSTUB( 0xFF85961C, _audio_ic_write )
NSTUB( 0xFF85944C, _audio_ic_read )
NSTUB( 0xFF85B0C8, sounddev_task )
NSTUB( 0x2360, sounddev )
NSTUB( 0xFF87CBD0, strcpy )
NSTUB( 0xFFA0FD18, ptp_register_handler )
NSTUB( 0xFF92EA48, gui_lock )
NSTUB( 0xFF893CD8, prop_request_icu_auto_poweroff )
NSTUB( 0xFFC455CC, memcpy )
NSTUB( 0xFF86C704, oneshot_timer )
NSTUB( 0xFF81DE08, hotplug_task )
NSTUB( 0x1AA4, hotplug_struct )
NSTUB( 0x1AD8, hotplug_usb_buf )
NSTUB( 0xFF864678, dispcheck )
NSTUB( 0x27624, bmp_vram_info )
NSTUB( 0x38920, vram_info )
NSTUB( 0xFFA413FC, vram_get_number )
NSTUB( 0xFF8773A4, task_trampoline )
NSTUB( 0x208A4, cf_device )
NSTUB( 0x2BA0, dm_names )
NSTUB( 0xFFA6BE34, gui_task_destroy )
NSTUB( 0xFF82399C, gui_main_task )
NSTUB( 0xFF82434C, gui_init_end )
NSTUB( 0x38F0, gui_timer_struct )
NSTUB( 0x1C4C, gui_main_struct )
NSTUB( 0xFF86D96C, msg_queue_receive )
NSTUB( 0xFF891BA0, gui_local_post )
NSTUB( 0xFF8916FC, gui_change_mode )
NSTUB( 0xFF891F98, gui_other_post )
NSTUB( 0xFF8921F0, gui_post_10000085 )
NSTUB( 0xFF892830, gui_init_event )
NSTUB( 0xFF8922A4, gui_change_shoot_type_post )
NSTUB( 0xFF89233C, gui_change_lcd_state_post )
NSTUB( 0xFFA6BBC4, ctrlman_dispatch_event )
NSTUB( 0xFF890188, gui_massive_event_loop )
NSTUB( 0xFF9B3910, gui_timer_something )
NSTUB( 0xFFCB48CC, audio_thresholds )
NSTUB( 0xFF85B438, sounddev_active_in )
NSTUB( 0xFF9B9FD0, alloc_dma_memory )
NSTUB( 0xFF9BA004, free_dma_memory )
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment