This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What is AIS (Application Image Script)?

Anonymous
Anonymous


Hi,

 

I would like to ask a question on AIS booting script.

 

For C/C++ main() to execute, c_int00() needs to be run first to prepare its global and static variables. Therefore, it seems to me that the role of bootloader is to load all the compiled and linked instructions from external memory into RAM.

 

Bootloader needs the following information:

1.    On which device does the code and data reside? By setting voltages of pins this can be informed to the CPU.

2.    The starting location of code/data is should extract from the external device: Bootloader by default loads 1K byte starting at the default address on the external device.

 

But here remains an unsolved problem: If the code is longer than 1K byte, say, 1KK = 1M, what can we do? If this is the case, the 1K code it loads from external memory cannot be the actual code itself, but should be sort of a “carrier” that would move the actual 1M code from external memory into RAM.

 

How should this “carrier” be written? It can of course be written in assembly code, which would be essentially a loop that would load the 1M code into RAM.

 

Question 1:

Can the “carrier” be written in C? C require its run-time environment be set first, so if the “carrier” is written in C, then its associated c_int00() needs also be load by the bootloader at first. This means both the “carrier” and its c_int00() needs to be placed at the default on the external memory for bootloader to retrieve, and their total size should not exceed than 1K byte.

 

Is this correct?

 

But what about error-detecting? If one writes completely in assembly or C by himself, then he should also write the necessary error-detecting routine using such as the standard CRC algorithm. Probably not everyone is skilled in that.

 

I guess, this is where AIS comes into play. AIS has its own 32-bit opcode which are different from opcode of the CPU instruction set, and should be only recognizable by the bootloader. So essentially AIS encodes the most common operations during booting, including GET, SET memory-mapped address (PLL, registers, etc.), CRC check and so on.

 

So essentially it is just another layer of encapsulation, just like GEL used by the emulator, and its commands would be translated into CPU instructions by the bootloader, which would then be executed and perform all the necessary loading + setting + error-detecting operation.  At last, when JUMP_CLOSE is encountered, it jumps to the starting address of cint_00() of the 1M (see above) actual code.

 

I am new to booting and AIS, and eagerly expecting comments on the above points.

 

    

 

Zheng