Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Code protect

(you are viewing a thread; or go back to list of threads)

Code protect (by Antonio Oliveira NICO)
Hi friends

How can I protect my code, to avoid new flash writes based in my user program?

My PIC is 18F877, the code protect bit is number 13 of 14-1 register, word adress 2007H. Bit13=0 the code is protected, Bit13=1 the code is opened.

I dont know if this bit is normally 1 or 0... and neither how to write it...

Thanks so much!
Mon Feb 6 2017, 18:21:17
Code protect (by DanielH)
Dear Antonio:

PIC 18F877 doesn't exist.
Do you mean 16F877?

AFAIK, by default, LDmicro compilation sets protection flags for PIC (CP for program, CPD for EEPROM data) as disabled, thus writing 1 in each protection bit in the configuration word(s).
In 16F877(a) the Bit13 (CP) and Bit8 (CPD) of word 2007H are set as 1.

If you download your compiled program (.hex generated by LDmicro) DIRECTLY in the PIC, without modifications, your program and your EEPROM data will be NOT protected against copy.

You can protect your program and EEPROM data if you use a programmer that allows to modify the configuration words before the download.
I use USBPICPROG, an open hardware and free software programmer, it allows those changes.

Of course, if you use a bootloader (for serial/USB download) and the .hex file compilated by LDmicro, there is no way to protect your work...

Best regards,
DanielH
Tue Feb 7 2017, 10:41:37
(no subject) (by Antonio Oliveira)
Perfect

Thanks DanielH!

Regards

Antônio
Tue Feb 7 2017, 13:05:07
(no subject) (by Ihor Nehrutsa)

PicKit3 help says, click on CONFIG to call Config Word Editor.
In my PicKit 3 CONFIG is grayed and disabled.
I can't call Config Word Editor.
How in your PicKit?
Tue Feb 7 2017, 13:50:25
Code protect (by DanieH)
@Ihor:

I'm sorry, I never ever used PicKit3 nor 2.

I'm running LDmicro on Arch Linux, under WINE program. It works flawlessly.

The only programmer I use is USBPICPROG: its software runs natively on Linux, I have builded my hardware myself (I use ICSP header), I wrote my own PKGBUILD (instructions needed to compile the software from source code on Arch Linux). I'm so happy with that.

By the way: I'm developing an open hardware project for educative purposes; in this project I use Tiny PIC Bootloader (running it under WINE) to download my programs in PIC 16F887 by means a USB to TTL serial converter. I can download programs and monitor UART data transmission in TBLD's virtual terminal without problems.

So, for the rest of my work (automation in industrial, public services and home environments), I habitually use PLC's, smart relays and HMI's softwares that runs natively on Linux, or that runs under WINE without messing my system.
Eventually, I run few softwares in a Window$ XP virtual machine (how old!), under Virtualbox...

Best regards,
DanielH
Tue Feb 7 2017, 21:38:00
(no subject) (by Ihor Nehrutsa)
to DanielH
Thanks for your explanation.

to DanielH and all

Can you publish link to your works based on LDmicro?
I would like to create a gallery of links to works(and authors) based on LDmicro.
It will show that everyone can create with LDmicro.
Wed Feb 8 2017, 07:57:31
(no subject) (by Ihor Nehrutsa)
LDmicro v4.1.6
http://cq.cx/ladder-forum.pl?action=viewthread&parent=6071
allow set any PIC Configuration Bits

See PIC Configuration Bits
https://github.com/LDmicro/LDmicro/wiki/PIC-Configuration-Bits
Fri Feb 17 2017, 05:28:23
LDmicro v4.1.6 (by DanielH)
@ Ihor:

Congratulations! I will test this new version.
Thanks for all your work!

Best regards,
danielH
Mon Feb 20 2017, 11:26:09
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):