PIC32 BootLoader
Macros | Typedefs | Enumerations | Functions | Variables
system.h File Reference

The functions are declared and defined state enumerations. More...

#include <p32xxxx.h>
#include <string.h>
#include <stdlib.h>
#include <sys/attribs.h>
Include dependency graph for system.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NVM_PAGE_SIZE   1024
 
#define BYTE_PAGE_SIZE   (4 * PAGE_SIZE)
 
#define ROW_SIZE   128
 
#define BYTE_ROW_SIZE   (4 * ROW_SIZE)
 
#define NUM_ROWS_PAGE   8
 
#define APP_FLASH_BASE_ADDRESS   0x9D006000
 
#define APP_FLASH_END_ADDRES   0x9D00FFFF
 

Typedefs

typedef unsigned char uint8_t
 
typedef unsigned short uint16_t
 
typedef unsigned long uint32_t
 
typedef unsigned int uint_t
 
typedef enum SYSTEM_STATUS_Tag SYS_STATE_t
 Enumeral represents different system states.
 
typedef enum SYSTEM_COM_PROTOCOL_MSG_Tag SYS_COM_PROTOCL_MSG_t
 Enumeral represents handshaking signals between programmer and controller.
 

Enumerations

enum  SYSTEM_STATUS_Tag {
  SYS_WAIT_FOR_START_CMND, SYS_CONFIG_FLASH, SYS_RCV_FIRMWARE_HEADER, SYS_FIRMWARE_UPDATE,
  SYS_RUN_APPLCN, SYS_SND_ADDRS_RANGE
}
 Enumeral represents different system states. More...
 
enum  SYSTEM_COM_PROTOCOL_MSG_Tag {
  SYS_START_CMND_FROM_PROGRMR = 0x01, SYS_READY_FOR_FIRMWARE_HEADER, SYS_FIRMWARE_HEADER_POS_ACK, SYS_FIRMWARE_HEADER_NEG_ACK,
  SYS_SND_NXT_CHUNK, SYS_ADDRESS_RANGE_TAG, SYS_ADDRESS_RANGE_RQT
}
 Enumeral represents handshaking signals between programmer and controller. More...
 

Functions

void runStateMachine (void)
 function executes different states of the system. SYS_SND_ADDRS_RANGE - Send the PIC programmable start and end address of the program memory SYS_WAIT_FOR_START_CMND - The Start command triggers system to start the process and initializes buffer counter SYS_RCV_FIRMWARE_HEADER - Get the total packet count from the host and applcn start address SYS_CONFIG_FLASH - Erase application program area and update table pointer SYS_FIRMWARE_UPDATE - Receive and put the binary chunks in the flash memory SYS_RUN_APPLCN - Run the application
 
void initVarConfigPort (void)
 
void runApplcn (void)
 PC is updated with the new pointer to execute loaded binary from the application flash program memory.
 

Variables

uint32_t applStartAdd
 
uint8_t totalNumberOfPacckets
 

Detailed Description

The functions are declared and defined state enumerations.

Author
Mallikarjun Tirlapur
Date
16 May, 2016

Macro Definition Documentation

§ APP_FLASH_BASE_ADDRESS

#define APP_FLASH_BASE_ADDRESS   0x9D006000

NVM start adress.

§ APP_FLASH_END_ADDRES

#define APP_FLASH_END_ADDRES   0x9D00FFFF

NVM end adress.

Enumeration Type Documentation

§ SYSTEM_COM_PROTOCOL_MSG_Tag

Enumeral represents handshaking signals between programmer and controller.

Enumerator
SYS_START_CMND_FROM_PROGRMR 

Config command signal from the programmer.

SYS_READY_FOR_FIRMWARE_HEADER 

Ready for firmware header signal sent to the programmer.

SYS_FIRMWARE_HEADER_POS_ACK 

Firmware header positive acknowledgement.

SYS_FIRMWARE_HEADER_NEG_ACK 

Firmware header negative acknowledgement.

SYS_SND_NXT_CHUNK 

send next chunk signal.

SYS_ADDRESS_RANGE_TAG 

send address with this tag.

SYS_ADDRESS_RANGE_RQT 

Rquest for the address from the host.

§ SYSTEM_STATUS_Tag

Enumeral represents different system states.

Enumerator
SYS_WAIT_FOR_START_CMND 

State where system waits for a start command from the programmer.

SYS_CONFIG_FLASH 

State where system configs flash

SYS_RCV_FIRMWARE_HEADER 

State where system waits for firmware header from the programmer

SYS_FIRMWARE_UPDATE 

State where system loads the binary into the NVM

SYS_RUN_APPLCN 

State where system jumps to the application

SYS_SND_ADDRS_RANGE 

State where the system sends the PIC programmable start and end address of the program memory

Variable Documentation

§ applStartAdd

uint32_t applStartAdd

Application start address.

§ totalNumberOfPacckets

uint8_t totalNumberOfPacckets

Variable holds the (size of the firmware/64) in bytes.