Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

what is Patch (in software/programming)

Status
Not open for further replies.

electroRF

Member
I hear a lot the term 'patch'.

What does it mean?

i.e.
- ROM Patch
- Patched Code / Data
- Patch a Code / Data

Thank you very much.
 
... a code section to replace/augment/modify an existing (possibly buggy) section.
 
I understand it as 'glue code' used to enable two subroutines of a program the ability to interact.
Usually added when an existing program is upgraded or extended.
 
Hi,
Thank you Alec and Eric.

alec_t said:
... a code section to replace/augment/modify an existing (possibly buggy) section.
Hi Alec,
Are you referring to Code Section in ROM that needs to be modified?

How does one utilize the SRAM in order to not re-burn the ROM for each modification one maekes? (Can ROM be re-burnt?)

Eric said:
I understand it as 'glue code' used to enable two subroutines of a program the ability to interact.
Usually added when an existing program is upgraded or extended.

Eric, could you please re-explain your first line?
I didnt understand it.

Thank you very much.
 
Are you referring to Code Section in ROM that needs to be modified?
Could be anywhere...ROM, EPROM, RAM, text.
Can ROM be re-burnt?
EPROM/Flash can.
 
Eric, could you please re-explain your first line?
I didnt understand it.
hi,
A simple example would be:
Consider you have a working existing program that requires upgrading, say then you want to add a UART option.

The format of the data in the current program may not be directly compatible for serial data transmission, so you would add a 'patch' that would convert
the data to and from the existing program to the UART code subr.
E
 
Hi Alec,
Thank you.
Could be anywhere...ROM, EPROM, RAM, text.
how can it be in RAM?
I'll explain -
All the Code is firstly burnt into ROM, only then it is copied to RAM.
i.e. if you make changes in the ROM already, the RAM's content will include "automatically" the same changes, isn't it?

BTW you're referring to the process where blocks of Code are copied into RAM for faster execution, right?


Eric said:
hi,
A simple example would be:
Consider you have a working existing program that requires upgrading, say then you want to add a UART option.

The format of the data in the current program may not be directly compatible for serial data transmission, so you would add a 'patch' that would convert
the data to and from the existing program to the UART code subr.
E

Hi Eric,
Nice Example :)

How would you add this patch?
Is this patch another function that you'll add?

btw, by code subr., you mean Code subroutine?


4pryos said:
No it must be replaced, It is Read Only Memory.
A PROM can be reprogrammed.

What then Companies who use ROM in their products do in the development stage?

How do they burn their SW after every change?
 
Last edited:
The definition of Patch is usually a fix that doesn't require recompiling. Not sure if that works now.

From what I understand, Tektronix used Patch EPROMS and address decoders, so pieces of a large program in ROM would be externally address decoded to the patch EPROM to execute. They could use the production software, but if a bug developed, they could redirect to an EPROM.

Here https://www.amplifier.cd/Test_Equipment/Tektronix/Tektronix_7000_series_mainframe/7854-ROM.html is a blurb (incomplete) as to how Tek did it. You might want to chase down the original quote.

A Patch might not be a released version.

In today's world, the patch definition might have changed. New Firmware might be considered a Patch.

In the old days when computers had switches to key in a program, one could "toggle" in a GoSub, add some new code and Return Back with re-compiling.

A "Patch" now might be Beta firmware or unreleased firmware.

Edit: Reference
 
Last edited:
hi,
A simple example would be:
Consider you have a working existing program that requires upgrading, say then you want to add a UART option.

The format of the data in the current program may not be directly compatible for serial data transmission, so you would add a 'patch' that would convert
the data to and from the existing program to the UART code subr.
E

I think what you described is a "Wrapper" or a "Wrapper Library" rather than a patch.

Patch is just a software update that updates only a small part of the software. Patch can include wrappers etc.
 
hi T,
I am talking from the days long before 'C' and Assemblers were available ie: programming in Machine Code.
We used patch's to 'join' sections of debugged [working] machine code together, in those days it was not possible to add a line of code and then either assemble or compile into a new program.

I guess over the years meanings change as well as new 'words' being created.

Eric
 
hi T,
I am talking from the days long before 'C' and Assemblers were available ie: programming in Machine Code.
We used patch's to 'join' sections of debugged [working] machine code together, in those days it was not possible to add a line of code and then either assemble or compile into a new program.

I guess over the years meanings change as well as new 'words' being created.

Eric

That is interesting to know. And that is probably the origin of the word.. just the meaning has evolved over time.

EDIT: Wikipedia has some interesting info:
"Historically, software suppliers distributed patches on paper tape or on punched cards, expecting the recipient to cut out the indicated part of the original tape (or deck), and patch in (hence the name) the replacement segment."
 
EDIT: Wikipedia has some interesting info:
"Historically, software suppliers distributed patches on paper tape or on punched cards, expecting the recipient to cut out the indicated part of the original tape (or deck), and patch in (hence the name) the replacement segment."

That brought back 'happy' memories.
The problems we had with the early 8 hole paper tape readers and punches back in the 1960's.:woot:
 
Thank you very much dear friends.

I got it thanks to you :)

When working with ROM, the Patches will of course be written in RAM.

How does one place Code in the Processor's RAM?

Is the programmer firstly burn the code to a Programmable Flash, which copies the Code to RAM?

Thank you.
 
How does one place Code in the Processor's RAM?

At least with AVRs, you can't execute code from RAM.
And even if you can do that, you would need to do that very carefully. I would say you would need to figure it out on your own.. design your own way to make it work.

Is the programmer firstly burn the code to a Programmable Flash, which copies the Code to RAM?
If the code is already in the flash, then it would be useless to copy it to RAM. Just execute the code from the flash.
I assume here that the programmable flash is the microcontrollers program memory.
 
electroRF said:
When working with ROM, the Patches will of course be written in RAM.

Not the way Tektronix did it. Patches/upgrades were done in EPROM. There was a huge cost difference between ROM and EPROM initially. An FPGA was also involved.

Now, it's simply a "Firmware update".
 
Now, it's simply a "Firmware update".
Yes, I don't see any sense using patches (updating small parts of firmware) in small embedded devices.. just do a full firmware update.
Patches today are meant to be used with very large software projects with many programmers involved. Linux is a good example of this.
 
There's a very popular unix program called "patch".

Say you have a huge source code (e.g. Linux kernel) and you figured you need to make small changes to few files. Instead of sending over the whole new source code, you create a small file which describes all the changes that you have made. The recipient then receives this file and uses the "patch" software to apply the changes.

If you look at software sites, they often, in addition to complete distributions have patches against previous distributions of source code. Say, you already have verstion 5.1.128 and want to upgrade to 5.1.129 of their software. You download the corresponding patch and use "patch" program to apply it. If you only have 5.1.127, then you first apply 5.1.128 patch then 5.1.129 patch, which may be still easier than full download.
 
Yes, I don't see any sense using patches (updating small parts of firmware) in small embedded devices.. just do a full firmware update.
Patches today are meant to be used with very large software projects with many programmers involved. Linux is a good example of this.

When you're working with ROM, you don't have a choice but to use patches and jump to the RAM when u encounter bugs
 
Last edited:
When you're working with ROM, you don't have a choice but to use patches and jump to the RAM when u encounter bugs
That is so disturbed... in many levels..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top