Flash Magic for code dumping (LPC1778)
In general, firmware images are not transferred over the UART verbatim; instead you communicate with a bootloader that provides in-system programming (ISP) functionality.

Section 37 of the LPC1778 user manual discusses the ISP commands and functionality.

A tool like Flash Magic sends commands to the bootloader to reprogram the chip incrementally. The particular algorithm will vary, but it probably looks something like:


Transfer a sector's worth of data to the LPC1778's buffer in RAM.
Erase the next flash sector to be reprogrammed.
Copy the buffer from RAM to flash
Compute the checksum of the newly written flash sector
Compute the checksum of the data in RAM to verify
Repeat until the entire firmware image has been written.


Accordingly, the amount of RAM available doesn't limit the bootloader's ability to reprogram the flash, though having more RAM available can speed up the process by reducing the amount of data transferred back and forth between the bootloader and the PC.