1.为什么需要Flashloader?什么是Flashloader?
许多厂商使用flash memory 作为一级代码存储器(primary code memory),但是基于功能或性能的原因,在download和debug工程(program)时,我们通常不能将program直接从调试器(debugger)写到flash memory。例如C-SPY(IAR Embedded Workbench 的调试器)只能直接将数据写到RAM上,所以需要通过flashloader把application下载到flash memory上。因此你必须在目标系统上执行一个专门的program--Flashloader。
Flashloader由一系列的,主要是擦写flash memeory的函数组成。
2.下载器debugger如何运行flashloader?
调试器debugger将flashloader下载到RAM中,并链接到一个地址上。要运行flashloader,debugger会将PC指针指向flashloader中的一个函数,并将该函数的数据和指令写到RAM缓冲器buff中,然后执行该函数。当该函数返回时,执行过程execution process 将会到达一个断点来指示该函数执行完成,然后debugger可以在flash加载过程(flashloading process)中进一步调用。简而言之,debugger在flashloader中调用函数。
3.Flashloader如何下载application到flash?
本文主要是对以下内容进行了翻译和理解:
BRIEFLY ABOUT FLASH LOADING
Many development boards use flash memory as the primary code memory.
When downloading and debugging a program, you cannot normally write directly from a debugger to flash memory, either for functional or performance reasons.
Instead, you must use a dedicated program—a flash loader—that executes on the target system.
Note: Although a flash loader is mostly used for flash memory, it can also be used, for example, with external RAM or disk-like storage devices.
In this guide, flash memory is the assumed type of memory.
THE FLASH LOADER
A flash loader is usually a small dedicated program, which can program one or more flash memories.
The flash loader is comprised of a set of functions, mainly for writing or erasing specified portions of flash memory.
The debugger downloads this program into RAM, where it is linked to an address.
To run the program, the debugger sets the PC to one of the functions in the flash loader,writes data and directives for that function into a RAM buffer, and executes the function.
When the function returns, the execution process will reach a breakpoint to indicate that the function has finished.
The debugger can then proceed to make further calls in the flash loading process.
In short, the debugger calls functions in the flash loader.