Skip to content

Conversation

petabyt
Copy link

@petabyt petabyt commented May 2, 2025

Around 2-3 years ago I got the 1300d 1.2.0 port working against this repo with a few tweaks. Now that the build system rewrite has stabilized some, maybe now is a good time to try again.

Anything copy-pasted or I'm not sure about has been labeled with a 'WTF' comment.

@reticulatedpines
Copy link
Owner

Thanks - I will look at this but it's not going to happen until after the 2025 release for old and new cams.

You've labelled it as a draft, and obviously I can't do much with "WTF" comments - it doesn't tell me what you're unsure about. This kind of discussion is probably better on Discord, although it can happen here if you prefer.

I don't have a 1300D so can't test this code on phys cam. What testing has been done? How much confidence do you have, and why? We had multiple reports of potentially permanent damage to 1300D using mlv_lite.mo. Have you tested this, or not?

It is now possible to control what modules are packaged with the zip file for cam build, with modules.included and modules.hidden. I'm surprised your changes build without these present. Either way, I recommend using these files to only include those modules that you've personally tested on phys cam. We can extend these as more modules are tested.

@Zi7ar21
Copy link

Zi7ar21 commented Jun 4, 2025

Hi, I get this error when I try to build your fork:

/usr/bin/arm-none-eabi-gcc -Os -D__ARM__ -Wp,-MMD,build/fps-engio.d -Wp,-MT,build/fps-engio.o -nostdlib -I../../include -Wall -Wextra -Werror-implicit-function-declaration -Wdouble-promotion -Winline -Wundef -Wno-unused-parameter -Wno-unused-function -Wno-format -fomit-frame-pointer -fno-strict-aliasing -ffast-math -fsingle-precision-constant -fno-builtin-printf -fno-common -fno-extended-identifiers -std=gnu99 -I../../src -ggdb3 -DCONFIG_MAGICLANTERN=1 -DCONFIG_DEBUGMSG=0  -DCONFIG_CONSOLE -DCONFIG_TCC -march=armv5te -I../../platform/1300D.120 -I../../platform/1300D.120/include -DCONFIG_1300D=1 -DCONFIG_1300D_120=1 -DRESTARTSTART=0xC80000 -DMAIN_FIRMWARE_ADDR=0xFE0C0000 -DCAMERA_MODEL=\"1300D\" -DCONFIG_FW_VERSION=120 -DCURRENT_CAMERA_SIGNATURE=SIG_1300D_120 -DVERSION=\"2025-06-04.1300D.120\" -DCONFIG_MODULES -DCONFIG_MODULES_MODEL_SYM=\"t6_120.sym\"  -MP -MD -c -o build/fps-engio.o ../../src/fps-engio.c -I. -Iinclude -Ibuild -I../../src -u strcasecmp -u memmove -u strstr -u strtof -u log10f -u log2f -u localeconv -u asinf -u strerror -u strpbrk -u ceilf -u tanf -u strspn -u fmodf -u acosf -u atan2f -u expf -u memchr -u frexpf -u __aeabi_f2ulz -u __aeabi_f2lz -u __aeabi_idiv -u __aeabi_idivmod
../../src/fps-engio.c: In function 'calc_tg_freq':
../../src/fps-engio.c:380:14: error: 'TG_FREQ_BASE' undeclared (first use in this function)
  380 |     int f = (TG_FREQ_BASE / timerA) * 1000 + MOD(TG_FREQ_BASE, timerA) * 1000 / timerA;
      |              ^~~~~~~~~~~~
../../src/fps-engio.c:380:14: note: each undeclared identifier is reported only once for each function it appears in
../../src/fps-engio.c: In function 'fps_timer_print':
../../src/fps-engio.c:1215:21: error: 'FPS_TIMER_A_MIN' undeclared (first use in this function); did you mean 'FPS_TIMER_B_MIN'?
 1215 |     int t_min = A ? FPS_TIMER_A_MIN : FPS_TIMER_B_MIN;
      |                     ^~~~~~~~~~~~~~~
      |                     FPS_TIMER_B_MIN
In file included from ../../src/gui-common.h:5,
                 from ../../src/dryos.h:41,
                 from ../../src/fps-engio.c:34:
../../src/fps-engio.c: In function 'tg_freq_print':
../../src/fps-engio.c:1244:9: error: 'TG_FREQ_BASE' undeclared (first use in this function); did you mean 'TG_FREQ_FPS'?
 1244 |         TG_FREQ_BASE / 1000000, (TG_FREQ_BASE % 1000000) / 10000
      |         ^~~~~~~~~~~~
../../src/menu.h:84:102: note: in definition of macro 'MENU_SET_VALUE'
   84 | #define MENU_SET_VALUE(fmt, ...)       snprintf(info->value,       MENU_MAX_VALUE_LEN,       fmt, ## __VA_ARGS__)
      |                                                                                                      ^~~~~~~~~~~
../../src/fps-engio.c: In function 'fps_try_to_get_exact_freq':
../../src/fps-engio.c:1273:18: error: 'FPS_TIMER_A_MIN' undeclared (first use in this function); did you mean 'FPS_TIMER_B_MIN'?
 1273 |     for (int t = FPS_TIMER_A_MIN; t < FPS_TIMER_A_MAX; t+= 2)
      |                  ^~~~~~~~~~~~~~~
      |                  FPS_TIMER_B_MIN
../../src/fps-engio.c: In function 'fps_try_to_get_180_360_shutter':
../../src/fps-engio.c:1306:21: error: 'TG_FREQ_BASE' undeclared (first use in this function); did you mean 'TG_FREQ_FPS'?
 1306 |     int Ta_approx = TG_FREQ_BASE / fps_x1000 * 1000 / 2 / Tb0;
      |                     ^~~~~~~~~~~~
      |                     TG_FREQ_FPS
../../src/fps-engio.c: In function 'fps_setup_timerA':
../../src/fps-engio.c:1396:22: error: 'TG_FREQ_BASE' undeclared (first use in this function); did you mean 'TG_FREQ_FPS'?
 1396 |             timerA = TG_FREQ_BASE / fps_x1000 * 1000 / fps_timer_b_orig;
      |                      ^~~~~~~~~~~~
      |                      TG_FREQ_FPS
In file included from ../../src/dryos.h:53:
../../src/fps-engio.c:1439:29: error: 'FPS_TIMER_A_MIN' undeclared (first use in this function); did you mean 'FPS_TIMER_B_MIN'?
 1439 |     timerA = COERCE(timerA, FPS_TIMER_A_MIN, timerA_max);
      |                             ^~~~~~~~~~~~~~~
../../src/imath.h:32:24: note: in definition of macro 'MAX'
   32 |    ({ __typeof__ ((a)+(b)) _a = (a); \
      |                        ^
../../src/fps-engio.c:1439:14: note: in expansion of macro 'COERCE'
 1439 |     timerA = COERCE(timerA, FPS_TIMER_A_MIN, timerA_max);
      |              ^~~~~~
make: *** [../Makefile:584: build/fps-engio.o] Error 1
make: *** Waiting for unfinished jobs....
[jacob@jacobarch 1300D.120]$ 

P.S. Is there some new place to discuss Magic Lantern development now? The 1300D forum post hasn't been posted to since 2023 and I wanna talk about porting ML to my camera :(

@petabyt
Copy link
Author

petabyt commented Jun 4, 2025

It's not finished yet. CONFIG_1300D has to be added to some of the ifdef chains in fps-engio and raw.c among others.

@Zi7ar21 check the 1300d topic on ML discord and you'll see all the work we've done so far

petabyt added 4 commits June 27, 2025 18:15
All of these values were taken from the critix 1300d 1.1.0 port.

The values in raw.c appear to be placeholder data copypasted from the 600D:
> `// PLACEHOLDER DATA FROM 600D TO BUILD HELLOWORLD`
Yet these weren't ever changed, and ended up being shipped in builds.

raw.c: https://bitbucket.org/ccritix/magic-lantern-git/src/234e117aba5a0b0147e9327656dc359d54e9ed04/src/raw.c
edmac-memcpy.c: https://bitbucket.org/ccritix/magic-lantern-git/src/234e117aba5a0b0147e9327656dc359d54e9ed04/src/edmac-memcpy.c
fps-engio.c: https://bitbucket.org/ccritix/magic-lantern-git/src/234e117aba5a0b0147e9327656dc359d54e9ed04/src/fps-engio.c#lines-309
Otherwise, cam would crash at boot because it places BSS outside the space available
for ML (ml_reserved_mem).

BSS is placed next to autoexec.bin, and (last time I checked) it assumed the space would be available
with no checks.

My memory isn't that great from this, and I think I misread a lot. So check this for the full story:

https://discord.com/channels/671072748985909258/807566022424789022/1279547942989987997
@petabyt
Copy link
Author

petabyt commented Jul 13, 2025

This port is crashing at boot, but the crash appears to be similar enough on qemu/hardware that it could be debugged in qemu.

ASSERT: 0
at SystemIF::KerSem.c:354, PropMgr:337c
lv:0 mode:0

PropMgr stack: 151238 [151360-150360]
0xUNKNOWN  @ 41fc:151350
0xUNKNOWN  @ fe2c234c:151328
0xFE2BEB4C @ fe10bc8c:151310
0xUNKNOWN  @ fe2beb7c:151300
0xUNKNOWN  @ fe2bec04:1512e0
0xUNKNOWN  @ fe294d70:1512a8
0xUNKNOWN  @ ca17b8:151278
0x00003CBC @ 3378:151270
0x00C875E4 @ cbe78c:151238

Magic Lantern version: 2025-07-13.1300D.120
Git commit: 01a18dc3c 1300d_take_2
Built on 2025-07-13 20:08:53 UTC by daniel@desktop.
Free Memory  : 260K + 898K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants