Compile TCA directly from source

This topic has been up before, but I like to bump it up again, and possibly add a few more aspects to consider.

Currently we use old G120 chips running TinyCLR 1.0, but we are on the verge of migrating to SCM20260 and TinyCLR 2.x, so this issue is current, even if it would be nice to have something work on the old platforms as well.

As of now we need to first deploy to a unit and then extract the TCA-file from the unit.
As we are modernizing our development we now need to make an automatic build process, and this seems to be a hassle if we need to go through the forementioned process.

Using TinyCLR 1.0 it was possible to reuse libraries from TinyCLR Config to use when deploying copies of the tca-files to new units. With this we could create our own command-line interface and make an automated process with a G120-unit connected to a build server somewhere. Since I know TinyCLR 2.x has been rebuild and is no longer based on NetMF I am not sure you’d let use reuse the libraries for using in our own tools the same way anymore. I havn’t began looking at this yet. Regardless, doing this solution seems like a hassle if there just was a way to compile the libraries and .exe-file from the visual studio bin-folder directly to a TCA-file.
I am no wizard, so this might be over my head to do myself, but is it possible that someone has already made a tool for this? Or if not, is there any documentation describing this process so that I might delegate the task?
Some guy at GHI obviously made this process automatic inside the chip. I am sure it would only be a 10 minute job to lift out that same logic and make it a stand alone app. A few more minutes to make it a built in selectable option directly into the visual studio extension.
My uneducated guess is that the files are more or less just merged together back to back, like with a compression tool, but uncompressed since the bin-folder is practically the same size as the TCA-file.

If this can be accomplished it would help us a lot, and it seems we are not the only ones.

Cheers, Tintin - OilQuick AB, Sweden

1 Like

How did you do that with TinyCLR 1.0 ?

I referenced the file GHIElectronics.TinyCLR.Debugger.dll that come with TinyCLR Config and used the Management.MFDeploy class

Code for anyone who might find it useful:

MFDeploy deploy = new MFDeploy();
IList portDefs = deploy.EnumPorts(GHIElectronics.TinyCLR.Debugger.Management.TransportType.USB);

        using (MFDevice device = deploy.Connect(portDefs[0]))
        {
           uint entryPoint = 0;
            if (device.Deploy("ourtcafile.tca",
                null, // signature file (optional)                                   
                ref entryPoint // return app's entry point                                    
                ))
            {
               device.Reboot(false);
                if (entryPoint != 0) // check if image has an entry point                        
                {
                    device.Execute(entryPoint);
                }
            }
            else
            {
                //Fail
            }
        }
1 Like

Hi, we haven’t tried this. But you can try.

After you have tca file with your key, you can use that key to decrypt tca from offset 0x400. Actual application starts from offset 0x400. Then you will get raw application that you can use the code above.

Encryption is xtea 128.

Thank you. This was an answer to the future question on how to deploy a tca file on 2.x systems. The real question here though, was if it is possible to build the tca file without deploying it to a unit first. Do you know of such possibilities?

Does your project need this?

It needs real devices to know secure dll, external deploy, find the best sector to put dll…

Of course there is possible but i am not sure about values of generating tca without device.

The reason this came up was as I wrote in the OP that we are modernizing our process, and having automatic builds is a feature we use in our other projects. But I am sure we can survive without that.

What is more of a hassle is that we need to have one of our development unit, complete with cables and whatnot every time with do a build.
A common scenario is when we have a customer with special needs and one of our service guys is there helping them, calling me up asking for a special feature to test. If I am at home or lets say on a train or whereever not in the office I will not be able to help them because I dont have a development unit available just for doing the deployment and build of tca file, even tho I always have a computer nearby on which I can easily code what they ask for.
If I could compile the tca-file directly on my laptop I could send them the file right away and they can test it on the spot.
(Our ghi-chip based devices weigh about 6 pounds, and nothing I wanna carry around with me all the time just for the occational need of making tca-files)

1 Like

when will you need this?

1 Like

I have requested this capability as well. Our product weights almost 100lbs. Almost impossible carrying it to the client place in order to generate the firmware image :wink:

The interim solution is using VMWare + TeamCity + AutoIt V3 to setup a auto clicker based build machine that always connected to one of our product. This way it allows us to build firmware every time a new commit is pushed in. But… oh boy this workflow is so fragile. Almost every windows update or power flick will break it and I have to logon to do some fix to get it back online.

I wish there is a way we can compile the firmware without a target board.

1 Like

There is no fire right now, but this is in the pipeline like everything else. The sooner we can solve this the better.

Generating tca without real device, sound like asking a woman make a baby without man :)). It is posible but not recommended :))).
Still need an approval from the top, but so far it is done about engineering.

  • Generate tca for TinyCLR config and raw file for MFDeploy()…
  • No key for tca this case, just 00-00…
  • Auto calculate external flash if application required.

1 Like

:rofl: :rofl: :rofl: :rofl: :rofl: :rofl:

Haha!! but Dat managed to make this happen! :nerd_face:

Dat can’t be described, Dat must be experienced

3 Likes

Thank you so much for implementing this!
This will surely help us plenty!

Regards, Tintin

1 Like