Main Page

Functions
flash.c File Reference

Go to the source code of this file.

## Functions
uint16_t | flash_read (Flash *flash, int addr)
void | flash_write (Flash *flash, int addr, uint16_t val)
void | flash_write_lo8 (Flash *flash, int addr, uint8_t val)
void | flash_write_hi8 (Flash *flash, int addr, uint8_t val)
Flash * | flash_new (int size)
void | flash_construct (Flash *flash, int size)
void | flash_destroy (void *flash)
int | flash_load_from_file (Flash *flash, char *file, int format)
int | flash_get_size (Flash *flash)
void | flash_dump_core (Flash *flash, FILE *f_core)

## Detailed Description

Flash memory methods.

This module provides functions for reading and writing to flash memory. Flash memory is the program (.text) memory in AVR's Harvard architecture. It is completely separate from RAM, which is simulated in the memory.c file.

Definition in file flash.c.

## Function Documentation

## § flash_read()

uint16_t flash_read | ( | Flash * | flash,
|  | int | addr
| ) |  |

Reads a 16-bit word from flash.

Returns
  A word.

Referenced by avr_core_insert_breakpoint(), and flash_dump_core().

## § flash_write()

void flash_write | ( | Flash * | flash,
|  | int | addr,
|  | uint16_t | val
| ) |  |

Reads a 16-bit word from flash.

Parameters

  flash | A pointer to a flash object.
  addr | The address to which to write.
  val | The byte to write there.

Definition at line 86 of file flash.c.

References display_flash().

## § flash_write_lo8()

void flash_write_lo8 | ( | Flash * | flash,
|  | int | addr,
|  | uint8_t | val
| ) |  |

Write the low-order byte of an address.

AVRs are little-endian, so lo8 bits in odd addresses.

Definition at line 98 of file flash.c.

## § flash_write_hi8()

void flash_write_hi8 | ( | Flash * | flash,
|  | int | addr,
|  | uint8_t | val
| ) |  |

Write the high-order byte of an address.

AVRs are little-endian, so hi8 bits in even addresses.

Definition at line 109 of file flash.c.

## § flash_new()

Flash* flash_new | ( | int | size | ) |

Allocate a new Flash object.

Definition at line 117 of file flash.c.

References avr_new, class_overload_destroy(), flash_construct(), and flash_destroy().

## § flash_construct()

void flash_construct | ( | Flash * | flash,
|  | int | size
| ) |  |

Constructor for the flash object.

Definition at line 131 of file flash.c.

References avr_error.

Referenced by flash_new().

## § flash_destroy()

void flash_destroy | ( | void * | flash | ) |

Destructor for the flash class.

Not to be called directly, except by a derived class. Called via class_unref.

Definition at line 153 of file flash.c.

Referenced by flash_new().

## § flash_load_from_file()

int flash_load_from_file | ( | Flash * | flash,
|  | char * | file,
|  | int | format
| ) |  |

Load program data into flash from a file.

Definition at line 164 of file flash.c.

Referenced by avr_core_load_program().

## § flash_get_size()

int flash_get_size | ( | Flash * | flash | ) |

Accessor method to get the size of a flash.

Definition at line 210 of file flash.c.

Referenced by avr_core_get_sizes().

## § flash_dump_core()

void flash_dump_core | ( | Flash * | flash,
|  | FILE * | f_core
| ) |  |

Dump the contents of the flash to a file descriptor in text format.

Parameters

  flash | A pointer to a flash object.
  f_core | An open file descriptor.

Definition at line 223 of file flash.c.

References flash_read().

Automatically generated by Doxygen 1.8.12 on Tue Apr 18 2017.