[UNMAINTAINED] Canon 5D Classic Firmware ** Beta 4 **

Started by coutts, June 14, 2012, 04:54:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

scrax

Updated a bit and after some more little changes now menu loads ok but still no fonts shown.

I'm using _load_fonts() and the only thing written that i can see is the screen with magic lantern info at first load of ML menu, also it's not formatted right it is "too big" for the 5D screen.

I've refactored stubs.S to be more similar to 5D2 one and commented all unused stubs

Not yet tried any function...

NOTE: Now compiling it with gcc-arm-none-eabi-4_7-2012q4 (because read it worked for 450D loading font bug but didn't solved the problem on 5DC sadly)

NOTE2: If _load_fonts() is removed i can no more see the intro text but only a black screen when first opening ML menu (so it is loading something at least)

NOTE3: Something seems to work (at least what I can test/recognize without fonts) like expo change in preview or MLU control, and also something else not like settings don't get saved and can't see overlay so far...

BTW: @A1ex about colors, yes ML has a pink color instead of orange when enabled config menu like in the pic you got from qemu

I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-


scrax

Quote from: Ant123 on March 30, 2019, 06:25:21 PM
Maybe you are loading fonts too early:
https://www.magiclantern.fm/forum/index.php?topic=8119.msg190359#msg190359
Thank's for help, I thought that too (was reading your post yesterday) and made some try with and without the FIO workaround.
With the workaround I get camera stuck, with blue led on (it should turn off when ml finished loading) so I think it get's stuck in that while loop.
With hardcoded msleep(550) some fonts get loaded, I suppose, because the first screen is the only one that show fonts.
If I remove the call to _load_fonts() also first screen don't show any font.
Maybe is something stupid like the color of the font same as background...or maybe i've made some mess by having merged old boot metod with cache hacks

From your code in the other thread I find out that I were not calling "_ml_cbr_init()" and that solved the problem with the menu not loading right.
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

scrax

Seems that font get loaded only at first and then they go, because after turning on the camera I can see exposure compensation message in review after pressing set but only first time and if I didn't opened yet ML menu

I've also added 5DC here

Now I'm getting an on screen ML ASSERT when in preview relative to mem.c:850 in __mem_malloc() but can't read it all because is half out of screen and nothing get written on card
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

aprofiti

@scrax I tried again starting from vxworks-dm-spy branch (haven't tried your patch yet, but looks like it isn't complete, how should I use it?), but I get stuck with a 5 seconds blue led on and 5 seconds off, which I need to track down.

Anyone know what it means? Trash button doesn't works and  firmware version in Canon l's Menu wasn't replaced by ML

Will try to post a diff later if I can go over; I tried to not put all inside dummy.c and find what was possible, but some stubs looks like are not present in the Rom disassembly compared to 40D/450D.

Didn't change init.c a lot, just lunch firmware as a pointer because I wasn't able to find why compiler is not able to find reference inside Stubs S...
Noticed it is much different from the one used in 40D and 450D. Does it need to be updated or is better to leave as is because more specific to 5dc?

To make them compile, I had to add dm-spy-extra and exmem into makefile as extra objs

EDIT: ML initialization hangs when calling hijack_gui_main_task(), when malloc memory for bmp_vram_idle_ptr or ml_big_init_task(); Menu and other buttons get partially overridden by hijacking function

diff --git a/platform/40D.111/Makefile.setup.default b/platform/40D.111/Makefile.setup.default
--- a/platform/40D.111/Makefile.setup.default
+++ b/platform/40D.111/Makefile.setup.default
@@ -13,4 +13,5 @@
ML_SRC_EXTRA_OBJS = \
init.o \
dummy.o \
- dm-spy.o
+ dm-spy.o \
+ dm-spy-extra.o
diff --git a/platform/40D.111/stubs.S b/platform/40D.111/stubs.S
--- a/platform/40D.111/stubs.S
+++ b/platform/40D.111/stubs.S
@@ -221,6 +221,9 @@
NSTUB(0xFFD56470,  TryPostStageEvent)
NSTUB(0xFFD564FC,  TryPostStageEvent_end)                   // PendStageEvent

+//TODO:
+NSTUB(0xFFD6A1C8,  current_task)                        // 0x22E00
+
NSTUB(0xFFD6A1C8,  get_current_task)                        // 0x22E00
NSTUB(0xFFD69F8C,  get_task_info)
NSTUB(0xFFD6B8B0,  get_active_task_list)
diff --git a/platform/Makefile.platform.map b/platform/Makefile.platform.map
--- a/platform/Makefile.platform.map
+++ b/platform/Makefile.platform.map
@@ -14,10 +14,10 @@
700D.114 \
EOSM.202 \
1100D.105 \
+ 5DC.111 \
6D.116

PLATFORM_MAP_UNMAINTAINED = \
- 5DC.111 \
100D.100 \

platform_map = $(filter $(1).%, $(PLATFORM_MAP))
diff --git a/platform/unmaintained/5DC.111/Makefile.setup.default b/platform/unmaintained/5DC.111/Makefile.setup.default
--- a/platform/unmaintained/5DC.111/Makefile.setup.default
+++ b/platform/unmaintained/5DC.111/Makefile.setup.default
@@ -10,16 +10,18 @@
fps-engio.o \
audio-ak.o \
movtweaks.o \
- exmem.o \
liveview.o \
bootflags.o \
lv-img-engio.o \
hdr.o \
+ exmem.o \
+

ML_SRC_EXTRA_OBJS = \
init.o \
dummy.o \
dm-spy.o \
- tp-spy.o
+ dm-spy-extra.o \
+ # tp-spy.o

CFLAG_USER += -Wno-unused-variable
diff --git a/platform/unmaintained/5DC.111/consts.h b/platform/unmaintained/5DC.111/consts.h
--- a/platform/unmaintained/5DC.111/consts.h
+++ b/platform/unmaintained/5DC.111/consts.h
@@ -2,8 +2,12 @@
  *  5Dc 1.1.1 consts
  */

+extern int _dummy_variable;
+
#define CANON_SHUTTER_RATING 100000

+#define CARD_DRIVE "A:/"
+
#define CARD_LED_ADDRESS 0xC02200A0 // http://magiclantern.wikia.com/wiki/Led_addresses
#define LEDBLUE     *(int*)0xC02200F0
#define LEDRED      *(int*)0xC02200A0
@@ -14,7 +18,7 @@
#define FORMAT_BTN "[Q]"
#define STR_LOC 11

-#define YUV422_LV_BUFFER_1 0x10b63e8
+#define YUV422_LV_BUFFER_1 0x10b63e8
#define YUV422_LV_BUFFER_2 0x10b63ec
#define YUV422_LV_BUFFER_3 0x10b63f0
#define YUV422_LV_BUFFER_DISPLAY_ADDR YUV422_LV_BUFFER_1
@@ -39,7 +43,11 @@
#define PLAY_MODE (gui_state == GUISTATE_PLAYMENU && MEM(0x27D8) && !MEM(0x3D50)) // StartPl1App, but not StartPlEraseApp
#define MENU_MODE (gui_state == GUISTATE_PLAYMENU && MEM(0x4C48)) // StartMenuMainHeaderApp

-#define CURRENT_GUI_MODE (gui_state == GUISTATE_PLAYMENU ? 1 : 0)
+// TODO:
+//#define CURRENT_GUI_MODE (gui_state == GUISTATE_PLAYMENU ? 1 : 0)
+#define CURRENT_GUI_MODE 1
+#define GUIMODE_PLAY 2
+#define GUISTATE_QR_ZOOM 3

#define NUM_PICSTYLES 9
#define PROP_PICSTYLE_SETTINGS(i) (PROP_PICSTYLE_SETTINGS_STANDARD - 1 + i)
@@ -106,4 +114,3 @@
//~ #define ARROW_MODE_TOGGLE_KEY ""

#define WINSYS_BMP_DIRTY_BIT_NEG 0
-
diff --git a/platform/unmaintained/5DC.111/dummy.c b/platform/unmaintained/5DC.111/dummy.c
--- a/platform/unmaintained/5DC.111/dummy.c
+++ b/platform/unmaintained/5DC.111/dummy.c
@@ -2,6 +2,7 @@
#include "bmp.h"
#include "gui.h"
#include "menu.h"
+#include "timer.h"

// dummy stubs

@@ -14,17 +15,17 @@
//~ void *CreateRecursiveLock(int n){}
void *ReleaseRecursiveLock(void *lock){ return NULL; }
//void bmp_zoom(uint8_t* dst, uint8_t* src, int x0, int y0, int denx, int deny) { return; }
-struct memSuite * shoot_malloc_suite_contig(size_t size) { return 0; }
-struct memSuite *shoot_malloc_suite(size_t size) { return 0; }
+struct memSuite * _shoot_malloc_suite_contig(size_t size) { return 0; }
+struct memSuite * _shoot_malloc_suite(size_t size) { return 0; }
struct memChunk * GetFirstChunkFromSuite(struct memSuite * suite) { return 0; }
-void* GetMemoryAddressOfMemoryChunk(struct memChunk * chunk) { return 0; }
-void shoot_free_suite(struct memSuite * hSuite) { return; }
+//void* GetMemoryAddressOfMemoryChunk(struct memChunk * chunk) { return 0; }
+//void shoot_free_suite(struct memSuite * hSuite) { return; }
struct memChunk * GetNextMemoryChunk(struct memSuite * suite, struct memChunk * chunk) { return 0; }
int audio_meters_are_drawn() { return 0; }
int override_zoom_buttons = 0;
void lcd_release_step(){};
void force_liveview() {};
-int lcd_release_running = 0;
+//int lcd_release_running = 0;
void set_shooting_mode(){};
int get_screen_layout(){ return 0; };
void rec_notify_trigger(){};
@@ -41,9 +42,9 @@
int is_mvr_buffer_almost_full(){ return 0; }
void rec_notify_continuous(){};
void movie_indicators_show(){};
-void display_shooting_info(){};
-void free_space_show_photomode(){};
-void dialog_redraw(){}
+//void display_shooting_info(){};
+//void free_space_show_photomode(){};
+void dialog_redraw(struct dialog * dialog){}
int digic_iso_gain_photo;
int digic_iso_gain_movie;
void MuteOff_0(){}
@@ -77,7 +78,7 @@
void volume_up(){};
void volume_down(){};

-void _EngDrvOut(int addr, int value) { MEM(addr) = value; }
+void _EngDrvOut(uint32_t reg, uint32_t value) { MEM(reg) = value; }
uint32_t shamem_read(uint32_t addr) { return 0; }
void _engio_write() {}

@@ -105,10 +106,12 @@
int get_effective_hdr_iso_for_display(int raw_iso ) { return 1; };
void set_movie_digital_iso_gain(int gain) {};

-int bmp_is_on() { return 1; }
+//int bmp_is_on() { return 1; }

-void* shoot_malloc(size_t size) { return AllocateMemory(size); }
-void shoot_free(void* ptr) { FreeMemory(ptr); }
+//void* shoot_malloc(size_t size) { return AllocateMemory(size); }
+void* _shoot_malloc(size_t size) { return malloc(size); }
+void _shoot_free(void* ptr) { free(ptr); }
+//void shoot_free(void* ptr) { FreeMemory(ptr); }

void display_gain_toggle(){};
//void yuv_resize(){};
@@ -118,3 +121,31 @@
void movie_tweak_menu_init() {};
//int hdr_video_enabled() { return 0; };
int get_digic_iso_gain_movie() { return 0; };
+
+//Altre
+//int sound_recording_enabled() { return 0; }
+//void DeleteMemorySuite(struct memSuite * suite) { }
+int SetTimerAfter(int delay_ms, timerCbr_t timer_cbr, timerCbr_t overrun_cbr, void* priv) { return 0; }
+void CancelDateTimer();
+int64_t FIO_SeekSkipFile( FILE* stream, int64_t position, int whence ) { return 0; }
+//0xFF015E9C
+void SetGUIRequestMode(int mode){}
+void* _srm_malloc(size_t size){ return malloc(size);}
+void _srm_free(void* ptr){free(ptr);}
+int _srm_get_free_space(){return 0;}
+int _srm_get_max_region(){return 0;}
+int _shoot_get_free_space(){return 0;}
+int _shoot_free_suite(){return 0;}
+struct memSuite * _srm_malloc_suite(int num_requested_buffers){}
+void _srm_free_suite(struct memSuite * suite){}
+
+/* per exmec.c */
+struct memSuite * CreateMemorySuite(void* first_chunk_address, size_t first_chunk_size, uint32_t flags) { return 0; }
+struct memChunk * CreateMemoryChunk(void* address, size_t size, uint32_t flags) { return 0; }
+void DeleteMemorySuite(struct memSuite * suite) { }
+int sound_recording_enabled() { return 0; }
+void SRM_AllocateMemoryResourceFor1stJob(void (*callback)(void** dst_ptr, void* raw_buffer, uint32_t raw_buffer_size), void** dst_ptr) { }
+int AddMemoryChunk(struct memSuite * suite, struct memChunk * chunk) { return 0; }
+void CancelDateTimer();
+void SRM_FreeMemoryResourceFor1stJob(void* raw_buffer, int unk1_zero, int unk2_zero) { }
+//int GetSizeOfMaxRegion(int* max_region) { return 0; }
diff --git a/platform/unmaintained/5DC.111/features.h b/platform/unmaintained/5DC.111/features.h
--- a/platform/unmaintained/5DC.111/features.h
+++ b/platform/unmaintained/5DC.111/features.h
@@ -17,7 +17,7 @@
#define FEATURE_HISTOGRAM
#define FEATURE_WAVEFORM
#define FEATURE_VECTORSCOPE
- #define FEATURE_OVERLAYS_IN_PLAYBACK_MODE
+//TODO: fixme #define FEATURE_OVERLAYS_IN_PLAYBACK_MODE
//#define FEATURE_FALSE_COLOR

/** Shoot menu **/
@@ -60,7 +60,7 @@

/** Debug menu **/

- #define FEATURE_SCREENSHOT
+//TODO: Enable later #define FEATURE_SCREENSHOT

#define FEATURE_DONT_CLICK_ME

@@ -72,4 +72,3 @@
     #define FEATURE_SHOW_FREE_MEMORY
//#define FEATURE_SHOW_SHUTTER_COUNT //not working
     #define FEATURE_SHOW_CMOS_TEMPERATURE
-
diff --git a/platform/unmaintained/5DC.111/gui.c b/platform/unmaintained/5DC.111/gui.c
--- a/platform/unmaintained/5DC.111/gui.c
+++ b/platform/unmaintained/5DC.111/gui.c
@@ -16,19 +16,28 @@
#include "dryos.h"

struct semaphore * gui_sem;
+extern void gui_massive_event_loop2( uint32_t, void *, uint32_t );
+extern void unknown_gui_function(uint32_t,uint32_t);
+extern void GUI_ChangeMode(uint32_t);
+extern void other_gui_post_event(uint32_t,uint32_t*,uint32_t);
+extern int bindGUISwitchCBR(int,int,int,int);
+extern void DeleteTask(int);
+extern int QueryTaskByName(char *);
+extern int handle_mlu_toggle(struct event * event);
+//TODO: Adapt to gui.c from 40D - was refactored?

// return 0 if you want to block this event
static int handle_buttons(struct event * event)
{
ASSERT(event->type == 0)
-
+
if (event->type != 0) return 1; // only handle events with type=0 (buttons)
if (handle_common_events_startup(event) == 0) return 0;
extern int ml_started;
if (!ml_started) return 1;

if (handle_common_events_by_feature(event) == 0) return 0;
-   
+
     if (handle_mlu_toggle(event) == 0) return 0;

return 1;
diff --git a/platform/unmaintained/5DC.111/init.c b/platform/unmaintained/5DC.111/init.c
--- a/platform/unmaintained/5DC.111/init.c
+++ b/platform/unmaintained/5DC.111/init.c
@@ -1,4 +1,5 @@
#include "dryos.h"
+#include "dryos-notes.h"
#include "bmp.h"
#include "gui.h"
#include "menu.h"
@@ -8,9 +9,14 @@
/** Specified by the linker */
extern uint32_t _bss_start[], _bss_end[];
extern void create_task_cmd_shell(const char * name);
+void hijack_gui_main_task();
void ml_big_init_task(); // forward declaration
int bmp_vram_idle_ptr;

+void config_parse_file( char * );
+extern uint32_t get_current_task();
+extern void ioGlobalStdSet(int,int);
+
void start_debug_mode() {
int file;
char filename[20] = "A:/DEBUG.LOG"; // default name
@@ -18,7 +24,9 @@
time_t t;
struct tm tm;

- file = (int) FIO_OpenFile(filename, O_CREAT | O_WRONLY , 644);
+// file = (int) FIO_OpenFile(filename, O_CREAT | O_WRONLY , 644);
+file = (int) FIO_OpenFile(filename, O_CREAT | O_WRONLY );
+
if(file > 0) {
// redirect stdout and stderr to our file
ioGlobalStdSet(1, file);
@@ -305,6 +313,7 @@
#endif
}/*}}}*/

+extern int init_code_run();
void copy_and_restart()
{/*{{{*/
//blink(1);
@@ -350,8 +359,11 @@

//cache_fake(0xFF810054, 0xE3A01078, TYPE_ICACHE); // MOV R1, #0x78
//cache_fake(0xFF810058, 0xE2811A01, TYPE_ICACHE); // ADD R1, R1, 0x1004 - enable caches
- firmware_entry();

+ //TODO: fixme
+// firmware_entry();
+ void (*reset)(void) = (void*) ROMBASEADDR;
+ reset();

// unreachable
while(1) {
@@ -450,7 +462,7 @@
  To hijack an EventDispatch of a manager or module, remember:
  - Modules have a StageClass
  - Managers have a TaskClass
-
+
  The structures for these are already defined in state-object.h
  NOTE: you can only hijack one manager or module at a time. Never try to hijack more than one! (could brick camera).
  **/
@@ -596,7 +608,7 @@
snprintf(assert_msg, sizeof(assert_msg),
"ML ASSERT:\n%s\n"
"at %s:%d (%s), task %s\n",
- msg,
+ msg,
file, line, func, get_task_name_from_id(get_current_task())
);
request_crash_log(2);
@@ -625,3 +637,15 @@
}
}/*}}}*/

+
+/* For gui-comon.c */
+int magic_off = 0; // Set to 1 to disable ML
+
+unsigned short int magic_is_off()
+{
+    return magic_off;
+}
+
+void _disable_ml_startup() {
+    magic_off_request = 1;
+}
diff --git a/platform/unmaintained/5DC.111/stubs.S b/platform/unmaintained/5DC.111/stubs.S
--- a/platform/unmaintained/5DC.111/stubs.S
+++ b/platform/unmaintained/5DC.111/stubs.S
@@ -52,8 +52,10 @@
NSTUB(0xFF811060,  aIcuFirmwareVer)
NSTUB(0xFF811078,  aK213)
NSTUB(0xFFB2A56C,  alloc_dma_memory)
+NSTUB(0xFFB2A56C,  _alloc_dma_memory)
NSTUB(0xFF8B6248,  AllocateFileCacheItem)
NSTUB(0xFFB2F664,  AllocateMemory)
+NSTUB(0xFFB2F664,  _AllocateMemory)
NSTUB(0xFFB40474,  armInitExceptionModes)
NSTUB(0xFF811000,  aRomReady)
NSTUB(0xFFB44EC4,  asctime)
@@ -172,8 +174,11 @@
NSTUB(0xFFB41CB0,  fputs)
NSTUB(0xFFB41D38,  fread)
NSTUB(0xFFB4CB14,  free)
+NSTUB(0xFFB4CB14,  _free)
NSTUB(0xFFB2A5B0,  free_dma_memory)
+NSTUB(0xFFB2A5B0,  _free_dma_memory)
NSTUB(0xFFB2F680,  FreeMemory)
+NSTUB(0xFFB2F680,  _FreeMemory)
NSTUB(0xFFB41E3C,  freopen)
NSTUB(0xFFB39988,  frexp)
NSTUB(0xFFB42024,  fscanf)
@@ -195,6 +200,7 @@
NSTUB(0xFFB1A1D0,  GetNameInformation)
NSTUB(0xFFB42AC4,  gets)
NSTUB(0xFFB19564,  GetSelfTaskHandle)
+NSTUB(0xffb2f734 ,GetSizeOfMaxRegion) //TODO: check again
NSTUB(0xFFB1FF74,  GetSystemTime)
NSTUB(0xFFB18430,  give_semaphore)
NSTUB(0xFF812308,  GM_Initialize)
@@ -256,6 +262,7 @@
NSTUB(0xFFB4B400,  logTask)
NSTUB(0xFFB4130C,  longjmp)
NSTUB(0xFFB4CB08,  malloc)
+NSTUB(0xFFB4CB08,  _malloc)
NSTUB(0xFFB4CAF4,  memAddToPool)
//NSTUB( 0xFFB4B774, memalign )
//NSTUB( 0xFFB44664, memcpy )
@@ -626,6 +633,7 @@
NSTUB(0xFFB29CC0,  TryPostStageEvent)
NSTUB(0xFFB29D4C,  TryPostStageEvent_end)

+NSTUB(0xFFB57898,  current_task) //TODO: fixme
NSTUB(0xFFB57898,  get_current_task)
NSTUB(0xFFB58490,  get_task_info)
NSTUB(0xFFB561F0,  get_active_task_list)
@@ -651,5 +659,3 @@
NSTUB(0xFFB4641C,  sub_FFB4641C)
NSTUB(0xFFB46508,  sub_FFB46508)
NSTUB(0xFFB46478,  sub_FFB46478)
-
-
diff --git a/src/bootflags.c b/src/bootflags.c
--- a/src/bootflags.c
+++ b/src/bootflags.c
@@ -120,7 +120,7 @@

// http://www.datarescue.com/laboratory/partition.htm
// http://magiclantern.wikia.com/wiki/Bootdisk
-#if !defined(CONFIG_500D) && !defined(CONFIG_50D) && !defined(CONFIG_5D2) && !defined(CONFIG_40D) && !defined(CONFIG_450D)
+#if !defined(CONFIG_500D) && !defined(CONFIG_50D) && !defined(CONFIG_5D2) && !defined(CONFIG_40D) && !defined(CONFIG_450D) && !defined(CONFIG_5DC)
int
bootflag_write_bootblock( void )
{
@@ -204,17 +204,17 @@
{
#if defined CONFIG_500D
     struct cf_device * const dev = sd_device[1];
-#elif defined(CONFIG_50D) || defined(CONFIG_5D2) || defined(CONFIG_40D) || defined(CONFIG_450D)// not good for 40D, need checking
+#elif defined(CONFIG_50D) || defined(CONFIG_5D2) || defined(CONFIG_40D) || defined(CONFIG_450D) || defined(CONFIG_5DC) // not good for 40D, need checking
     struct cf_device * const dev = cf_device[5];
#endif
-   
+
     uint8_t *block = fio_malloc( 512 );
-   
+
     int i;
     for(i=0; i<512; i++) block[i] = 0xAA;

     dev->read_block( dev, 0, 1, block ); //overwrite our AAAs in our buffer with the MBR partition of the SD card.
-   
+
     // figure out if we are a FAT32 partitioned drive. this spells out FAT32 in chars.
     // FAT16 not supported yet - I don't have a small enough card to test with.
     //if( block[0x52] == 0x46 && block[0x53] == 0x41 && block[0x54] == 0x54 && block[0x55] == 0x33 && block[0x56] == 0x32 )
diff --git a/src/console.c b/src/console.c
--- a/src/console.c
+++ b/src/console.c
@@ -315,6 +315,7 @@

/* some functions from standard I/O */

+#ifndef CONFIG_5DC
int printf(const char* fmt, ...)
{
     /* when called from init_task, 512 bytes are enough to cause stack overflow */
@@ -336,3 +337,4 @@
     console_puts("\n");
     return 0;
}
+#endif
diff --git a/src/debug.c b/src/debug.c
--- a/src/debug.c
+++ b/src/debug.c
@@ -2004,7 +2004,7 @@
     return 1;
}

-#if defined (CONFIG_40D) || defined(CONFIG_450D)
+#if defined (CONFIG_40D) || defined(CONFIG_450D) || defined(CONFIG_5DC)
void _redraw_do() { }
#endif

diff --git a/src/dryos-notes.h b/src/dryos-notes.h
--- a/src/dryos-notes.h
+++ b/src/dryos-notes.h
@@ -54,6 +54,7 @@
extern void audio_level_task(void);
extern void audio_interval_unlock(void*);

+/*
extern FILE *
FIO_OpenFile(
         const char *            name
@@ -63,7 +64,7 @@
int mode
#endif
);
-
+*/
extern ssize_t
FR_SyncReadFile(
         const char *            filename,
diff --git a/src/fio-ml.c b/src/fio-ml.c
--- a/src/fio-ml.c
+++ b/src/fio-ml.c
@@ -353,18 +353,25 @@
FILE* _FIO_OpenFile(const char* filename, unsigned mode );

/* this one returns 0 on error, just like in plain C */
+/*#ifdef CONFIG_VXWORKS
+FILE* FIO_OpenFile(const char* filename, int flags,
+ int mode)
+
+#else*/
FILE* FIO_OpenFile(const char* filename, unsigned mode )
+//#endif
+
{
     char new_filename[FIO_MAX_PATH_LENGTH];
     fixup_filename(new_filename, filename, sizeof(new_filename));
-   
+
     FILE* f = _FIO_OpenFile(new_filename, mode);
-   
+
     if (f != PTR_INVALID)
     {
         return f;
     }
-   
+
     return 0;
}

diff --git a/src/fio-ml.h b/src/fio-ml.h
--- a/src/fio-ml.h
+++ b/src/fio-ml.h
@@ -100,7 +100,19 @@
};

// file IO
+/*
+#ifdef CONFIG_VXWORKS
+extern FILE *
+FIO_OpenFile(
+        const char *            name
+ ,
+ int flags,
+ int mode
+);
+#else*/
extern FILE* FIO_OpenFile( const char* filename, unsigned mode );
+//#endif
+
extern int FIO_ReadFile( FILE* stream, void* ptr, size_t count );
extern int FIO_WriteFile( FILE* stream, const void* ptr, size_t count );
extern void FIO_CloseFile( FILE* stream );
diff --git a/src/mem.c b/src/mem.c
--- a/src/mem.c
+++ b/src/mem.c
@@ -1547,9 +1547,9 @@
             },
             MENU_EOL
         },
-    },
+    },
+#endif
};
-#endif

void mem_menu_init()
{
diff --git a/src/menu.c b/src/menu.c
--- a/src/menu.c
+++ b/src/menu.c
@@ -129,7 +129,7 @@

static int is_customize_selected();

-#if defined (CONFIG_40D)  || defined(CONFIG_450D)
+#if defined (CONFIG_40D)  || defined(CONFIG_450D) || defined(CONFIG_5DC)
void CancelDateTimer() { }
#else
extern void CancelDateTimer();
diff --git a/src/posix.c b/src/posix.c
--- a/src/posix.c
+++ b/src/posix.c
@@ -40,10 +40,12 @@
}

/* warning - not implemented yet */
+#ifndef CONFIG_5DC
int time()
{
     return 0;
}
+#endif

int clock()
{
diff --git a/src/raw.c b/src/raw.c
--- a/src/raw.c
+++ b/src/raw.c
@@ -288,6 +288,15 @@
      -887, 10000,     2129, 10000,    6051, 10000
#endif

+#ifdef CONFIG_5DC // these values are in ufraw-0.22
+    //~{ "Canon EOS 40D", 0, 0x3f60,
+        //~{ 6071,-747,-856,-7653,15365,2441,-2025,2553,7315 } },
+    #define CAM_COLORMATRIX1                       \
+     6071, 10000,     -747, 10000,    -856, 10000, \
+    -7653, 10000,    15365, 10000,    2441, 10000, \
+    -2025, 10000,     2553, 10000,    7315, 10000
+#endif
+
#ifdef CONFIG_40D // these values are in ufraw-0.22
     //~{ "Canon EOS 40D", 0, 0x3f60,
         //~{ 6071,-747,-856,-7653,15365,2441,-2025,2553,7315 } },
@@ -400,6 +409,11 @@
static int dynamic_ranges[] = {1100, 1094, 1060, 1005, 919, 826, 726, 633};
#endif

+#ifdef CONFIG_5DC
+// TODO: FIXME: correct values
+static int dynamic_ranges[] = {1100, 1094, 1060, 1005, 919, 826, 726, 633};
+#endif
+
#ifdef CONFIG_450D
// TODO: FIXME: correct values
static int dynamic_ranges[] = {1100, 1094, 1060, 1005, 919, 826, 726, 633};
diff --git a/src/shoot.c b/src/shoot.c
--- a/src/shoot.c
+++ b/src/shoot.c
@@ -1309,6 +1309,10 @@
void expo_adjust_playback(int dir)
{
#ifdef CONFIG_5DC
+    //TODO: fixme
+    extern void BmpDDev_take_semaphore();
+    extern void BmpDDev_give_semaphore();
+
     static int expo_value = 0;
     if (dir == 0)
     {
diff --git a/src/tasks.c b/src/tasks.c
--- a/src/tasks.c
+++ b/src/tasks.c
@@ -210,6 +210,7 @@
     info->custom_drawing = CUSTOM_DRAW_THIS_MENU;
     
#if defined(CONFIG_VXWORKS)
+/*extern int get_active_task_list(void* arr,int n)

     if (entry->selected)
     {
@@ -251,7 +252,7 @@
             y = 10;
         }
     }
-
+*/
#else // DryOS - https://groups.google.com/forum/#!msg/ml-devel/JstGrNJiuVM/2L1QZpZ7F4YJ

     #ifdef CONFIG_TSKMON
diff --git a/src/tweaks.c b/src/tweaks.c
--- a/src/tweaks.c
+++ b/src/tweaks.c
@@ -1098,8 +1098,8 @@
                     while (!quickzoom_unpressed && PLAY_MODE)
                     {
                         #ifdef CONFIG_5DC
-                        (int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR) = MIN((int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR) + 3, IMGPLAY_ZOOM_LEVEL_MAX);
-                        (int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR + 4) = MIN((int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR + 4) + 3, IMGPLAY_ZOOM_LEVEL_MAX);
+                        MEM(IMGPLAY_ZOOM_LEVEL_ADDR) = MIN((int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR) + 3, IMGPLAY_ZOOM_LEVEL_MAX);
+                        MEM(IMGPLAY_ZOOM_LEVEL_ADDR + 4) = MIN((int32_t)MEM(IMGPLAY_ZOOM_LEVEL_ADDR + 4) + 3, IMGPLAY_ZOOM_LEVEL_MAX);
                         #endif
                         fake_simple_button(BGMT_PRESS_ZOOM_IN);
                         msleep(50);

aprofiti



Figured out how to use two patches from scrax to have a copy of his previous and post tracked what was the main problem.
Don't know why it's showing only 2 menu tabs.

Assert related to mem.c was solved adding "_mem_init()" before malloc space for "bmp_vram_idle_ptr" and to make loads fonts is necessaries to "call_init_funcs(0)" before "_load_fonts()".

If I try to load all tasks, I get an error related to 5DC.sym I still need to figure out, probably related to module_task.
Unfortunately I'm still unable to make my previous patch to works, even with init.c and gui.c from scrax's work.

Here is the link to the patch (may have unnecessary changes because is a mix of an old patch found in the forum).

Any help is appreciated

scrax

Quote from: aprofiti on May 14, 2019, 05:53:52 AM


Figured out how to use two patches from scrax to have a copy of his previous and post tracked what was the main problem.
Don't know why it showing only 2 menu tabs.

Assert related to mem.c was solved adding "_mem_init()" before malloc space for "bmp_vram_idle_ptr" and to make loads fonts is necessaries to "call_init_funcs(0)" before "_load_fonts()".

If I try to load all tasks, I get an error related to 5DC.sym I still need to figure out, probably related to module_task.
Unfortunately I'm still unable to make my previous patch to works, even with init.c and gui.c from scrax's work.

Here is the link to the patch (may have unnecessary changes because is a mix of an old patch found in the forum).

Any help is appreciated
Nice to see some progress, good finding for the fonts...
will try your edits
And yes 5DC.sym should be related to modules so for now I think we can disable to compile module function to avoid the error
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

aprofiti

Had a look again at ML initialization routine for missing calls and now is looking much better :)



I'm using this sequence inside ml_big_init_task() of platform/5DC.111/init.c:

  _mem_init();
  bmp_vram_idle_ptr = (int)malloc(360*240);
  _find_ml_card();
  _load_fonts();
  call("DisablePowerSave");
  _ml_cbr_init();
  menu_init();
  debug_init();
  call_init_funcs(0);
  msleep(200); // leave some time for property handlers to run
  config_load();
  debug_init_stuff();


Modules loading still crashes without enabling anything (only available arkanoid, file_man, bench, pic_view from compilation), but this time error message is different.

Overlays doesn't works (they were working in beta4), same with intervalometer and there are still some problem while rendering text of task list; MLU works, also expo change in play mode.



ETTR as text of config submenu, like with 450D, if I try to change camera freezes but after reboot wasn't appearing anymore (still a lot of empty selection)

aprofiti

Regarding text in "Show Task" submenu... I played a bit with the code and got it printed good, it appears to be a problem with x position/spacing between each line; also Canon tasks are so much and need an additional windows to lists them all.

Found how to re-enable overlay in play mode, but I need to figure out why Histogram is not rendered (can see only borders) and Vectorscope/Waveform/Spotmeter get away when zebra and Focus Peek are enabled because it clean the framebuffer.

Regarding Intervalometer... it worked sometimes but I need to check again in which cases picture is taken.

Quote from: aprofiti on May 15, 2019, 12:11:24 AM
Modules loading still crashes without enabling anything (only available arkanoid, file_man, bench, pic_view from compilation), but this time error message is different.
Finally I found where module loading get stuck, but did't found a solution yet...

do
    {
        if (file.mode & ATTR_DIRECTORY){
            printf("Is a directory\n");             
           continue; // is a directory            <---- HERE
         }
        if (module_valid_filename(file.name))     <---- NEVER TAKEN
        {
            printf("NOT a directory\n");
            char module_name[MODULE_FILENAME_LENGTH];

            .....

    } while( FIO_FindNextEx( dirent, &file ) == 0);
    FIO_FindClose(dirent);

Is looping in the folder condition indefinitely....

@a1ex What do you think? Is code not compatible with vxworks or maybe there is a problem with the FIO_FindNextEx stub?

I checked if unified got some fix but there is nothing related and don't know if it's a problem also for other vxworks cameras like 450D (Can't check in Qemu because I think the rom dump I have is not ok)

aprofiti

Figured out what wasn't working with my patch.
Continuous blinking led was due to dump_with_buffer() in init.c and no boot was due to a wrong stub (double-checked Stubs.s with the one from scrax)

@scrax I committed current changes to my repository.
If anyone wants to try the current changes (+ PLAY mode saturation re-enabled but not committed yet), you can find a compiled build here

I'm still trying to figure out how to solve module loading (same problem with config reset/load and all other src files which are using ATTR_DIRECTORY code-block) and why Histogram is not being drawn.

I tried to enable Screenshoot but did't saved anything to card yet... with White Balance feature I get property change request errors.
Didn't tried to enable others because I was first figuring how to fix previous features with the recent codebase.

DebugMsgs are working, need to find how to intercept messages from MPU.

lizard™

This is so cool. I don't have a 5DC and will probably never get one but it's amazing that you guys put all this time and effort into this port.

Just wanted to give y'all some appreciation for that.

aprofiti

I'm trying to find Shutter Counter by dumping MPU memory region and trying to understand EEPROM content with help from a1ex.

This is after taking a second dump after releasing the shutter:

You can see some areas with seems to be mirrored like in camera firmware and a byte incremented by one digit.

Using this as starting point, after taking a bounce of pictures the same byte at right is incremented, but something strange happened when taking more to make counter rolls over:


Assuming a Big-Endian representation we was expecting to see these FF near the last byte to change, but apparently first byte from left is incremented (looking like to be counter or a index or some other meaning) and next digit start to increment at the next byte from the previous one.




If someone want to help you can download "magiclantern-BETA.2019Sep24.5DC111_mpu_dump.zip" from this download page and report.

How to run: go to Debug Tab -> Don't click me
Then you will find MPU dumps from ROM,ROM2 and EEPROM. (each test will overwrite previous file)

Camera will write immediately to EEPROM after releasing the shutter, so take a couple, diff them and compare to mine.

it will be much valuable to understand how it works If you are aware of approximate shutter counts (reported by camera service).

heder

Hi aprofiti

All the problems with text rendering is also present on the 40D. I made a temporary solution ony my own branch, remove shadow and
forcing that the text length (in some situations) is computed differently.

My fixes is visible at https://bitbucket.org/jmheder/magic-lantern/commits/e2d841e31a716afe1404a31afa69c7dc61179018
... some text here ..

aprofiti

Thanks heder, I solved using a different approach:
I observed texts are rendered good if using even values for line position.

So I changed only the code block related to vxworks camera, without impacting other ML code.



As a side effect first left line Is sligthly touching text of the task screen name.

Here is the commit showing what I changed.

I would like to know if this approach is working also for 40D and 450D, or only for 5DC.

aprofiti

I found how to figure out shutter counts for 5dc, it works on my camera but still not doubled checked on a second body.
Don't ask for posting more explanations about, no chances at the moment, at least until it's sure won't hurt ML community....

71m363nd3r

Quote from: aprofiti on December 29, 2019, 12:07:38 AM
I found how to figure out shutter counts for 5dc, it works on my camera but still not doubled checked on a second body.
Don't ask for posting more explanations about, no chances at the moment, at least until it's sure won't hurt ML community....

You can send me PM and I can check it on my 5D classic, no problem.

gadolf

Quote from: csoller on October 19, 2012, 09:52:23 PM
Im experiencing some weird battery drain issue while the camera is turned off. I havent had this in the earlier versions. I am not sure why. The workaround however is pretty easy, ill not store the battery in the camera when its unused.

Same here, and it's a fast drain.
I installed it yesterday and the battery drain is the sole reason I will uninstall it.
Anyway, thanks to coutts and others for the effort!

aprofiti

Didn't noticed a fast battery drain with my camera.
Which build where you using?

kotofei

I`ve got 5D Classic with 5Dc-b4 today.
didn't attach importance about it, but... PASM selector works incorrectly. Activates Bulb mode in Av position and M - in others. Changes CF card to the one without ML cure it.
Pass it for beta-5, may be.
Canon EOS 70D (1.1.2)
Nightly.2018Dec24.70D112

aprofiti

Tried to solve some issues these days and finally got the module subsystem to load :)


Quote from: aprofiti on May 26, 2019, 02:41:54 PM

I'm still trying to figure out how to solve module loading (same problem with config reset/load and all other src files which are using ATTR_DIRECTORY code-block) and why Histogram is not being drawn.

I tried to enable Screenshoot but did't saved anything to card yet... with White Balance feature I get property change request errors.
Didn't tried to enable others because I was first figuring how to fix previous features with the recent codebase.

Double checked FIO stubs and found there was an error in the 5DC codebase:

//NSTUB(0xFFB4720C,  FIO_FindNextEx)    wrong address
NSTUB(0xFFAE6018,  FIO_FindNextEx)


Quote
I got module subsistem loading but it's listing wrong module's name and so fail to load them due to missing file on card.
This is how it's showing them:

edmac.mo -> c.mo
mpu_dump -> dump.mo
mlv_lite -> lite.mo
file_name.mo -> name.mo
arcanoid.mo-> noid.mo
pic_view.mo -> view.mo

Looks like it is using only 4 characters from position 4 to 7.

Figured it out, on 5DC fio_file struct is a bit different and name is at different offset, don't know about the others fields:

/** Directory entry returned by FIO_FindFirstEx() */
struct fio_file {
        //! 0x10 == directory, 0x22
        uint32_t                mode;           // off_0x00;
        uint32_t                size;
        uint32_t                timestamp;      // off_0x08;

        // 5DC has name 4 byte before DryOS, not sure about other VxWorks camera
        #ifndef CONFIG_5DC   
        uint32_t                off_0x0c;
        #endif

        char                    name[ FIO_MAX_PATH_LENGTH ];
        uint32_t                a;
        uint32_t                b;
        uint32_t                c;
        uint32_t                d;
};





Using a recent codebase compared to beta4 was breaking overlay drawing in playback mode, found it was missing functions in zebra-5dc.c due to more recent changes in main codebase, still need to fix Histogram which is empty at the moment; I tried also to use zebra.c and after some time got all working except zebras which makes camera freezes and Histogram which get draw as a green rectangle.

Wish list: custom af points and lua scripting.

At the moment, I'm tring to check if features of beta4 are working with current codebase from vxworks branch and also when merging unified into it; need to found how to make Property Changes working, make screenshoot works and check for dependant features from it, find a way to makes benchmark and other debugging functions to work, add missing features from features.h and refactor some code blocks.

Will try to commit changes to my repository soon, so everyone can check and hope to have a more featured build to share also.

nikfreak

[size=8pt]70D.112 & 100D.101[/size]

0xAF

// AF

heder

Nice work.

Other random notes regarding modules:
cf_acc module (show CF card controller specs on screen)
cf_acc, CF card controller has master address on 0xc0620000 (DIGIC 4)
cf_acc, CF card controller has master address on 0xc0700000 (DIGIC 3)
If/when you get it running, post image.

... some text here ..

skala

Plz help me!
After install ML on 5Dc camera starts once and now dont boot up. When insert battery blue and red leds are lights up and nothing happens next. I Try tests all runs.

skala

7 hours kent start canera... and helps this:
Check if all doors are closed. The camera will not boot if any of the card or battery doors are open ! :o