Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:04 05 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Embedding a program

Author Message
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 06:18pm 17 Nov 2014
Copy link to clipboard 
Print this post

This might be useful to someone...

If you write a program for the Micromite and set the following options:
OPTION BREAK 0
OPTION AUTORUN ON

you end up with a program that cannot be stopped or interrupted. To further bullet proof it you could use the watchdog timer and OPTION PIN.

You can then use a PICKit3 and MPLAB IPE to read the complete flash memory of the Micromite and export it as a hex file. This will contain MMBasic and your program and the above options.

The hex file can be sent to someone as a custom firmware for the MX150/MX170 chip. They can load the hex file and it will immediately start running your program. To them it will be indistinguishable from firmware written in C (other than the startup banner produced by MMBasic). They do not have to load MMBasic and they do not need know anything about programming the Micromite.

As a test I created the attached hex file which just prints lots of dots on the screen. If you program a blank MX170 chip with it you will see what I mean.
2014-11-18_041423_Test.zip

GeoffEdited by Geoffg 2014-11-19
Geoff Graham - http://geoffg.net
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 06:35pm 17 Nov 2014
Copy link to clipboard 
Print this post

Cool - nice idea, will check it out. Embedding is one of the areas I currently use PICAXE for, but if you can lock-down the uM enough...
Smoke makes things work. When the smoke gets out, it stops!
 
jimbotron
Regular Member

Joined: 27/11/2013
Location: Australia
Posts: 46
Posted: 02:08am 18 Nov 2014
Copy link to clipboard 
Print this post

That's pretty cool, but you should code protect your device to avoid it being cloned.

It took me a little while to work it out, so here are the steps if you need them.
I summary you need to go into advanced mode, enable hex export and the memory display. You'll then read the contents of the chip and modify the code protect bit before exporting the hex file. Any chip you flash with the hex file will be uncopyable.

Details

Goto Settings -> Advanced Mode

Logon

Select the "Production Mode" page

Enable "Allow Export Hex" - This will allow the code to be exported. It's disabled by default.

Under the "Allow Memory View" section:

Enable "Config Memory" - We'll need this to see and change the code protection option.

Select the "Operate" page

Click the "Read" button. This will load the flash contents onto the PC

Goto "View" -> "Show Memory" - This will display the memory

The "Memory View" will appear. Select "Config Memory" from the drop down on the lower right of the screen.

Scroll to the bottom of memory view to get to the "Code Protect" category.
Change the setting to "Protection Enabled"

Optional step, if you click program to write back to the chip at this point it will become code protected. I have confirmed the application can still alter the flash.

Goto File -> Export -> Hex
Save the hex file.

If you program a chip with this file it will be code protected.

I was going to suggest setting the code protection bit from code when locking it, but then I realised you'd never be able to create a clone yourself unless you made locking optional.

Jimmy






 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024