Development iteration best practices?

Started by dmk, September 01, 2016, 08:15:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dmk

When developing a module, is it necessary to compile, install onto card, boot card onto cam, enable module, run it, rinse and repeat?

More to the point- I'm wondering how the devs approach iteration and testing. Do you build a bunch of tests and hook them up to buttons or whatever and then run it? e.g. write larger chunks at a time, test more rarely?

Basically just looking for advice about iteration and approach to coding ML for more fun :D

a1ex

Yes, that's pretty much it. A wifi card helps a bit (you no longer have to move the card back and forth, but you may end up waiting for the card to connect, restarting the wifi drivers and so on, so overall it's slower that way).

I usually hook things to a menu and print debug info on the console (printf) or on the screen (bmp_printf, NotifyBox).

You may also test simple things (such as menu code) in QEMU. It's not very fast either, you still have to install onto a SD card image, but it may make some things easier. For example, you can step into your code with GDB or IDA, or you can use printf's to QEMU console (qprintf), or it may be easier to get Canon's debug messages. Disadvantage: emulation is incomplete, no LiveView (you can get a static image with a few hacks, so testing image overlays is fine) and Canon GUI only works on a few camera models.

For reverse engineering, there are some useful tools in the dm-spy-experiments branch, see http://www.magiclantern.fm/forum/index.php?topic=2388.10


eduperez

Quote from: a1ex on September 01, 2016, 09:53:15 AMA wifi card helps a bit (you no longer have to move the card back and forth, but you may end up waiting for the card to connect, restarting the wifi drivers and so on, so overall it's slower that way).

I saw your code, and wondered why you did it that way... My card is configured as a wifi client, and as soon as the camera powers up, it connects to the router and gets a fixed IP address; then I can send files from any computer in my network with a simple command, no need to change between access points.

I also toyed with the idea of pulling the file from the card itself, using the card's capabilities to execute scripts on events (https://flashair-developers.com/en/documents/api/lua/guide/), but still haven't found the time to test it.

a1ex

Yes, this works as well, but only if I'm very close to the router (which is not always the case). This configuration is described in the first post in the linked thread.

To use this with my Makefile script, simply set WIFI_CARD_NETWORK to your regular network, and WIFI_CARD_IP to your static IP. It will still attempt to reconnect to the same network at the end (which wastes a few seconds), but this can be optimized easily.