Read about our upcoming Code of Conduct on this issue

Commit 2f4103e6 authored by alex@thinkpad.localdomain's avatar alex@thinkpad.localdomain
Browse files

Merged unified into card_fmt

--HG--
branch : card_fmt
......@@ -85,6 +85,8 @@ modules/*/*.mo
modules/*/*.sym
modules/*/*.rsc
modules/*/hgstamp
modules/*/hgdiff.tmp
modules/*/hginfo.tmp
modules/*/module_strings.h
modules/raw_rec/raw2dng
modules/raw_rec/raw2dng.exe
......
......@@ -20,6 +20,14 @@ $(ALL_SUPPORTED_MODELS)::
7D:: 7D_MASTER
$(MAKE) -C $(PLATFORM_PATH)/7D.203
5D3.113:
$(MAKE) -C $(PLATFORM_PATH)/5D3.113
5D3.123:
$(MAKE) -C $(PLATFORM_PATH)/5D3.123
5D3: 5D3.113 5D3.123
7DFIR: 7D_MASTER 7D
dd if=$(PLATFORM_PATH)/7D.203/autoexec.bin of=$(PLATFORM_PATH)/7D.203/autoexec.fir bs=288 skip=1 >/dev/null 2>&1
dd if=$(PLATFORM_PATH)/7D_MASTER.203/autoexec.bin of=$(PLATFORM_PATH)/7D_MASTER.203/autoexec.fir bs=288 skip=1 >/dev/null 2>&1
......
......@@ -16,13 +16,13 @@ all::
%.s: %.c
$(call build,CC -S,$(CC) $(CFLAGS) -S -o $@ $<)
%.sym: %
$(call build,SYMBOLS,$(READELF) -sW $< | $(GREP) GLOBAL | $(GREP) -E 'FUNC|OBJECT|ABS|NOTYPE' | $(AWK) "{print \$$2 \" \" \$$8;}" | $(GREP) -v '^ ' | $(GREP) -v __config_ | $(GREP) -v -E ' _[a-zA-Z]' | sort > $@)
$(call build,SYMBOLS,$(READELF) -sW $< | $(GREP) GLOBAL | $(GREP) -v " UND " | $(GREP) -E 'FUNC|OBJECT|ABS|NOTYPE' | $(AWK) "{print \$$2 \" \" \$$8;}" | $(GREP) -v '^ ' | $(GREP) -v __config_ | $(GREP) -v -E ' _[a-zA-Z]' | sort > $@)
%.o: %.c
$(call build,CC,$(CC) $(CFLAGS) -c -o $@ $<)
%.o: $(PLATFORM_DIR)/%.c
$(call build,CC,$(CC) $(CFLAGS) -c -o $@ $<)
%.o: $(SRC_DIR)/%.c
$(call build,CC,$(CC) $(CFLAGS) -c -o $@ $<)
%.o: $(PICOC_PATH)/%.c
$(call build,CC,$(CC) $(CFLAGS) -c -mthumb -fwhole-program -o $@ $<)
%.i: %.c
$(call build,CPP,$(CC) $(CFLAGS) -E -c -o $@ $<)
%: %.c
......@@ -31,14 +31,10 @@ all::
$(call build,AS,$(CC) $(AFLAGS) -c -o $@ $<)
%.o: $(SRC_DIR)/%.S
$(call build,AS,$(CC) $(AFLAGS) -c -o $@ $<)
%.o: %.c
$(call build,CC,$(CC) $(CFLAGS) -c -o $@ $<)
autoexec.bin: autoexec $(XOR_CHK)
$(call build,OBJCOPY,$(OBJCOPY) -O binary $< $@)
$(call build,OBJCOPY,$(OBJCOPY) -O binary $< $@)
$(call build,XOR_CHK,$(XOR_CHK) $@)
autoexec-fir.bin: autoexec-fir $(XOR_CHK)
$(call build,OBJCOPY,$(OBJCOPY) -O binary $< $@)
$(call build,OBJCOPY,$(OBJCOPY) -O binary $< $@)
$(call build,XOR_CHK,$(XOR_CHK) $@)
%.bin: %
......
......@@ -6,7 +6,7 @@ _CONFIGS_compile_name = _compile
_CONFIGS_clean_name = _clean
_CONFIGS_install_name = _install
_CONFIGS_to_filter_out = CONFIG_PICOC
_CONFIGS_to_filter_out =
_CONFIGS_to_compile = $(filter-out $(_CONFIGS_to_filter_out), $(ML_SETUP_CONFIGS_WITH_DIR))
......@@ -29,26 +29,11 @@ CONFIG_%$(_CONFIGS_install_name): CONFIG_%$(_CONFIGS_compile_name)
install:: prepare_install_dir install_extra_data $(_CONFIGS_install)
$(INSTALL_FINISH)
prepare_install_dir:
mkdir -p $(INSTALL_ML_DIR)
mkdir -p $(INSTALL_FONTS_DIR)
mkdir -p $(INSTALL_SETTINGS_DIR)
mkdir -p $(INSTALL_DATA_DIR)
mkdir -p $(INSTALL_CROPMARKS_DIR)
mkdir -p $(INSTALL_SCRIPTS_DIR)
mkdir -p $(INSTALL_SCRIPTS_LIB_DIR)
mkdir -p $(INSTALL_LOGS_DIR)
mkdir -p $(INSTALL_DOC_DIR)
install_extra_data: prepare_install_dir
$(CP) $(FONT_DIR)/*.rbf $(INSTALL_FONTS_DIR)/
$(CP) $(VRAM_DIR)/*.lut $(INSTALL_DATA_DIR)/
$(CP) $(CROP_DIR)/*.bmp $(INSTALL_CROPMARKS_DIR)/
$(CP) $(SCRIPT_DIR)/*.lua $(INSTALL_SCRIPTS_DIR)/
$(CP) $(SCRIPT_LIB_DIR)/*.lua $(INSTALL_SCRIPTS_LIB_DIR)/
# $(CP) $(SCRIPT_DIR)/*.c $(INSTALL_SCRIPTS_DIR)/
# $(CP) $(SCRIPT_DIR)/*.py $(INSTALL_SCRIPTS_DIR)/
$(INSTALL_ALL_SCRIPTS)
copy-autoexec: autoexec.bin
$(CP) autoexec.bin $(INSTALL_DIR)
......@@ -78,10 +63,14 @@ installdoc:
prepare_zip: FORCE
$(eval INSTALL_DIR = $(PWD)/zip)
$(eval INSTALL_PREPARE = )
$(eval INSTALL_FINISH = )
$(eval WIFI_SD = )
$(eval export INSTALL_DIR)
$(eval export INSTALL_MODULES_DIR)
$(eval export INSTALL_PREPARE)
$(eval export INSTALL_FINISH)
$(eval export WIFI_SD)
$(call rm_dir, $(INSTALL_DIR)/)
$(warning remove $(INSTALL_DIR))
mkdir -p $(INSTALL_DIR)
......
......@@ -24,12 +24,12 @@ build = \
$2
define rm_files
@printf "[ RM ] %s\n" "$1";
@printf "[ RM ] %s\n" "$1";
@$(RM) -f $1
endef
define rm_dir
@printf "[ RM dir ] %s\n" "$1";
@printf "[ RM dir ] %s\n" "$1";
@-$(RM) -rf $1
endef
......@@ -47,7 +47,7 @@ TARGET_COMPILER ?= arm-gcc
CFLAGS =
ifeq ($(TARGET_COMPILER), arm-gcc)
CFLAGS += -Os -mthumb-interwork -march=armv5te \
CFLAGS += -Os -march=armv5te \
-D__ARM__
endif
......@@ -63,14 +63,21 @@ CFLAGS +=\
-Wdouble-promotion \
-ffast-math \
-fsingle-precision-constant \
-fshort-double \
-fno-builtin-printf \
-std=gnu99 \
-Winline \
-I$(PLATFORM_INC) \
-I$(PLATFORM_INC)/include \
-I$(SRC_DIR) \
-I$(PICOC_PATH) \
# The short-double flag is removed in GCC 6+
GCC_DUMPVERSION := $(shell ${CC} -dumpversion)
ifneq (,$(findstring GCC-4,GCC-$(GCC_DUMPVERSION)))
CFLAGS += -fshort-double
endif
ifneq (,$(findstring GCC-5,GCC-$(GCC_DUMPVERSION)))
CFLAGS += -fshort-double
endif
NOT_USED_FLAGS=\
......@@ -118,3 +125,27 @@ ML_SETUP_CONFIGS_WITH_DIR = $(_CONFIGS-with-dir-file)
CFLAGS += $(CFLAG_USER)
FLAGS += $(LFLAG_USER)
AFLAGS += $(AFLAG_USER)
# install preparing targets are called from both platform and modules
# however, placing these rules at the top will select "install_prepare"
# as the default target, which is not what we want
# fixme: better solution?
.DEFAULT_GOAL := all
install_prepare:
$(INSTALL_PREPARE)
install_finish:
$(INSTALL_FINISH)
.PHONY: install_prepare install_finish
prepare_install_dir: install_prepare
@echo "[ MKDIR ] ML directory structure..."
@$(MKDIR) -p $(INSTALL_ML_DIR)
@$(MKDIR) -p $(INSTALL_MODULES_DIR)
@$(MKDIR) -p $(INSTALL_FONTS_DIR)
@$(MKDIR) -p $(INSTALL_DATA_DIR)
@$(MKDIR) -p $(INSTALL_CROPMARKS_DIR)
@$(MKDIR) -p $(INSTALL_SCRIPTS_DIR)
@$(MKDIR) -p $(INSTALL_DOC_DIR)
......@@ -10,8 +10,6 @@ DATE=date -u
BINARIES_PATH=binaries
LUA_PATH=$(TOP_DIR)/lua
PICOC_DIR=$(TOP_DIR)/picoc
PICOC_PATH=$(PICOC_DIR)
PWD=$(shell pwd)
SRC_DIR=$(TOP_DIR)/src
PLATFORM_PATH=$(TOP_DIR)/platform
......@@ -21,7 +19,6 @@ FONT_DIR=$(TOP_DIR)/data/fonts
CROP_DIR=$(TOP_DIR)/data/cropmks
VRAM_DIR=$(TOP_DIR)/data/vram
SCRIPT_DIR=$(TOP_DIR)/scripts
SCRIPT_LIB_DIR=$(SCRIPT_DIR)/lib
MODULES_DIR=$(TOP_DIR)/modules
BIN_FILES=magiclantern magiclantern.bin autoexec.bin autoexec
CF_CARD_ML_DIR = $(CF_CARD)/ML
......@@ -37,11 +34,23 @@ INSTALL_SETTINGS_DIR= $(INSTALL_ML_DIR)/settings
INSTALL_DATA_DIR= $(INSTALL_ML_DIR)/data
INSTALL_CROPMARKS_DIR= $(INSTALL_ML_DIR)/cropmks
INSTALL_SCRIPTS_DIR= $(INSTALL_ML_DIR)/scripts
INSTALL_SCRIPTS_LIB_DIR = $(INSTALL_SCRIPTS_DIR)/lib
INSTALL_DOC_DIR = $(INSTALL_ML_DIR)/doc
INSTALL_LOGS_DIR = $(INSTALL_ML_DIR)/logs
INSTALL_PREPARE ?= $(MOUNT_CARD)
INSTALL_FINISH ?= $(UMOUNT) $(CF_CARD)
# this one is called from both platform and modules
# copies all scripts, preserving directory structure
# (simpler way to do this?)
INSTALL_ALL_SCRIPTS = \
$(call build,SCRIPTS,\
for f in $(shell find $(SCRIPT_DIR) -type f -name *.lua); do \
dst=$(INSTALL_SCRIPTS_DIR)/$${f\#\#$(SCRIPT_DIR)/}; \
dstdir=`dirname $$dst`; \
$(MKDIR) -p $$dstdir; \
$(CP) $$f $$dst; \
done)
make_loop = +$(foreach entry, $(1), $(MAKE) -C $(entry) $(2);)
# $1 = root_dir
......
......@@ -11,10 +11,79 @@ ifeq ($(UNAME), Darwin)
else
# Default settings for remaining operating systems
UMOUNT=umount
CF_CARD="/media/EOS_DIGITAL/"
# CF_CARD=/media/EOS_DIGITAL
CF_CARD:=$(shell mount | grep -oE "[^ ]+/EOS_DIGITAL[^ ]*")
STAT_CMD=stat -c "%n: %s bytes"
endif
# change this if you have to mount the card every time you run "make install"
# examples:
# MOUNT_CARD=gvfs-mount -d /dev/mmcblk0p1
# MOUNT_CARD=gvfs-mount dav://192.168.0.1/
MOUNT_CARD=
# Experimental setup for Wi-Fi SD cards
# to enable, run this before "make install":
# export WIFI_SD=y
# alternatives: "make install WIFI_SD=y", "WIFI_SD=y make install"
# override network names and IP address in Makefile.user
# fixme: how to enable it from Makefile.user?
ifeq ($(WIFI_SD),y)
# fill in the name of your regular wifi network
# leave this empty to disable wifi after installation
WIFI_MAIN_NETWORK=<your regular wifi network>
# these are for Toshiba FlashAir; you may have to change them for other wifi cards
# note: if the wifi card connects directly to a router and gets a fixed IP,
# just enter your regular wifi network name here as well
WIFI_CARD_NETWORK=flashair
WIFI_CARD_IP=192.168.0.1
CF_CARD=/run/user/1000/gvfs/dav:host=$(WIFI_CARD_IP),ssl=false
# executed before installation
# connect to WIFI_CARD_NETWORK if not already,
# and mount card directory via WebDAV
INSTALL_PREPARE=$(call build,WIFI_SET,\
if !(nmcli conn show --active | grep $(WIFI_CARD_NETWORK) > /dev/null); then \
while !(nmcli device wifi list | grep $(WIFI_CARD_NETWORK)); do \
if [ `nmcli radio wifi` = disabled ]; \
then nmcli radio wifi on; sleep 5; \
else nmcli dev wifi rescan 2>/dev/null || true; sleep 2; \
fi; \
echo -n "."; \
done; \
nmcli conn up $(WIFI_CARD_NETWORK); \
fi; \
if (ping -c 3 -l 3 $(WIFI_CARD_IP) > /dev/null) ; then \
if !(gvfs-mount -l | grep "dav://$(WIFI_CARD_IP)/"); then \
gvfs-mount dav://$(WIFI_CARD_IP)/ ; \
fi; \
else \
echo "$(WIFI_CARD_IP) appears to be offline." ; \
exit 1; \
fi; )
# restore connection to your main wifi network
# or just turn it off if you are using a wired network
WIFI_RESTORE=$(call build,WIFI_END,\
if [ "$(WIFI_MAIN_NETWORK)" = "" ]; then \
echo "Turning off Wi-Fi..."; \
nmcli radio wifi off; \
elif !(nmcli conn show --active | grep $(WIFI_MAIN_NETWORK) > /dev/null); then \
echo "Connecting to $(WIFI_MAIN_NETWORK)..."; \
nmcli conn up $(WIFI_MAIN_NETWORK); \
fi; )
UMOUNT_CARD=$(call build,UNMOUNT,while !(gvfs-mount -u dav://$(WIFI_CARD_IP)/); do sleep 2; done)
# executed after installation
define INSTALL_FINISH =
$(UMOUNT_CARD)
$(WIFI_RESTORE)
@echo "\nFinished.\nMake sure the camera will not write anything to the card until restart."
endef
endif
# Supported camera models
SUPPORTED_MODELS:=50D 60D 550D 600D 500D 5D2 5D3 7D 650D 700D EOSM 1100D 6D
......
......@@ -39,6 +39,15 @@ int main (int argc, char *argv[])
/* modify checksum */
data ^= checksum;
/* check footer before overwriting */
uint64_t footer_magic = 0;
fseek(f, -8, SEEK_END);
if ((fread(&footer_magic, 8, 1, f) != 1) || (footer_magic != 0xCCCCCCCCE12FFF13))
{
printf("Footer magic error (expected 0x%lX, got 0x%lX)\n", 0xCCCCCCCCE12FFF13, footer_magic);
return -1;
}
fseek(f, -4, SEEK_END);
......@@ -51,4 +60,4 @@ int main (int argc, char *argv[])
fclose(f);
return 0;
}
\ No newline at end of file
}
#!/bin/sh
#
# This script uses experimental bitbacket API!
#
# see details:
# https://answers.atlassian.com/questions/163739/what-is-the-url-of-a-pull-request?page=1
#
CHECKPATCH=scripts/checkpatch.pl
PREQ_NUM=$1
[ "$PREQ_NUM" -gt 0 ] 2>/dev/null
if [ "$?" != 0 ]; then
echo "Usage:"
echo " scripts/check-bb-pull-request.sh <pull request number>"
exit 2
fi
if [ ! -x "$CHECKPATCH" ]; then
echo "no checkpatch utility ($CHECKPATCH)!"
exit 1
fi
TFILE=$(mktemp)
wget https://bitbucket.org/api/2.0/repositories/hudson/magic-lantern/pullrequests/$PREQ_NUM/patch -O $TFILE 2>/dev/null
if [ "$?" = "0" ]; then
$CHECKPATCH $TFILE | \
sed "s/^.*\(has no obvious style pr\)/Pull request #$PREQ_NUM \1/"
else
echo "Can't download pull requst #$PREQ_NUM"
fi
rm -f $TFILE
#!/bin/sh
CHECKPATCH=scripts/checkpatch.pl
if [ ! -x "$CHECKPATCH" ]; then
echo "no checkpatch utility ($CHECKPATCH)!"
exit 1
fi
TFILE=$(mktemp)
hg diff > $TFILE
$CHECKPATCH $TFILE
rm -f $TFILE
This diff is collapsed.
......@@ -56,10 +56,12 @@ On the 5D there are the following fonts added to the stubs.S file:
0xf00d1110: HCanonGothic 36 px, ascii only (0xFFE2)
0xf00d585c: CanonMonoSpace 40 px, ascii only (0xFFD8)
Alex, 16Mar2011
https://bitbucket.org/hudson/magic-lantern/changeset/cfba492ea84d
Daniel Fort, 05Jul2017
https://bitbucket.org/hudson/magic-lantern/pull-requests/844/find_fntpy-update/diff
"""
......@@ -105,6 +107,17 @@ def parseBitmap(m, off, base):
nb_byte = nb_byte + 1
print ' bitmap size = 0x%x' % ( nb_byte*height )
def guess_load_addr(rom, name):
if rom[4:12] == "gaonisoy":
return 0xFF010000 # assume old DIGIC 4 ROM dumped from 0xFF010000
if "ROM0" in name:
return 0xF0000000 # ROM0 from ML/LOGS/
if "ROM1" in name:
return 0xF8000000 # ROM1 from ML/LOGS/
# unknown, just report the offset inside the ROM.
return 0
f = open(sys.argv[1], 'rb')
m = f.read()
f.close()
......@@ -112,10 +125,11 @@ f.close()
if (len(sys.argv)>2):
base = int(sys.argv[2], 16)
else:
base = 0xff010000
base = guess_load_addr(m, sys.argv[1])
print 'Find bitmap fonts in Canon DSLR firmwares'
print 'Arm.Indy. based on work by Pel, Trammel Hudson and A1ex\n'
print 'Arm.Indy. based on work by Pel, Trammel Hudson and A1ex'
print 'Assume ROM file was dumped from 0x%08x \n' % base
off = 0
while off < len(m) and off <> -1:
......
......@@ -8,6 +8,8 @@ top_dir = "../"
# override the autodetection
force_used = [
"SetASIFMode",
"_audio_ic_write_bulk",
"AbortEDmac",
]
force_unused = [
"vram_get_number", # old way of accessing VRAM (5D2 only)
......@@ -36,6 +38,7 @@ force_unused = [
"PackMem_RegisterEDmacPopCBRForMemorySuite",
"PackMem_SetEDmacForMemorySuite",
"PackMem_StartEDmac",
"CreateDialogBox",
"FIO_SeekFile",
]
......@@ -69,6 +72,7 @@ def cleanup_stub(inp_file, out_file):
lines = open(inp_file).readlines()
if out_file: out_file = open(out_file, "w")
else: out_file = sys.stdout
# for each line
for l in lines:
......@@ -83,17 +87,25 @@ def cleanup_stub(inp_file, out_file):
if not check_used(name):
print "%s: unused" % name
if "???," not in l:
if out_file:
print >> out_file, comment_out(l)
print >> out_file, comment_out(l)
continue
elif name in force_used and l.strip().startswith("///"):
# commented out? uncomment and the address looks valid
addr = m.groups()[1]
addr = addr.replace("RAM_OFFSET", "");
addr = addr.strip(" -");
try:
addr = int(addr, 16)
l = l.lstrip('/ ')
except:
print "%s: invalid address %s" % (name, addr)
if out_file:
print >> out_file, l
print >> out_file, l
if out_file:
if out_file != sys.stdout:
out_file.close()
check_used("FIO_ReadFile")
#check_used("CreateDialogBox")
inputs = sys.argv[1:]
......
......@@ -14,6 +14,7 @@ data_structs = [
"LCD_Palette",
"sd_device",
"cf_device",
"cf_device_ptr",
"task_max",
"gui_main_struct",
"mvr_config",
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
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