|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +# |
| 4 | +# Copyright (c) 2021, Niklas Hauser |
| 5 | +# |
| 6 | +# This file is part of the modm project. |
| 7 | +# |
| 8 | +# This Source Code Form is subject to the terms of the Mozilla Public |
| 9 | +# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 10 | +# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 11 | +# ----------------------------------------------------------------------------- |
| 12 | + |
| 13 | +def init(module): |
| 14 | + module.name = ":fatfs.petit" |
| 15 | + module.description = """ |
| 16 | +# Petit FatFs: Tiny FAT Filesystem |
| 17 | +
|
| 18 | +Petit FatFs is a sub-set of FatFs module for tiny 8-bit microcontrollers. It can |
| 19 | +be incorporated into the tiny microcontrollers with limited memory even if the |
| 20 | +RAM size is less than sector size. |
| 21 | +
|
| 22 | +See http://elm-chan.org/fsw/ff/00index_p.html. |
| 23 | +
|
| 24 | +
|
| 25 | +## Configuration |
| 26 | +
|
| 27 | +To configure Petit FatFs for your project, create a `<pffconf_local.h>` file, |
| 28 | +which is included at the *beginning* of the config, thus overwriting the default |
| 29 | +settings. Please see the `modm/ext/fatfs-petit/pffconf.h` file for the available |
| 30 | +configuration options and their default values. |
| 31 | +
|
| 32 | +Example `<pffconf_local.h>` configuration: |
| 33 | +
|
| 34 | +```c |
| 35 | +// Enable directories: pf_opendir(), pf_readdir() |
| 36 | +#define PF_USE_DIR 1 |
| 37 | +
|
| 38 | +// Enabling writing: pf_write() |
| 39 | +#define PF_USE_WRITE 1 |
| 40 | +
|
| 41 | +// Use FAT12 file system |
| 42 | +#define PF_FS_FAT12 1 |
| 43 | +#define PF_FS_FAT16 0 |
| 44 | +#define PF_FS_FAT32 0 |
| 45 | +``` |
| 46 | +""" |
| 47 | + |
| 48 | +def prepare(module, options): |
| 49 | + return True |
| 50 | + |
| 51 | +def build(env): |
| 52 | + env.collect(":build:path.include", "modm/ext") |
| 53 | + env.outbasepath = "modm/ext/fatfs-petit" |
| 54 | + |
| 55 | + env.copy("fatfs/tiny/source/diskio.h", "diskio.h") |
| 56 | + env.copy("fatfs/tiny/source/pff.h", "pff.h") |
| 57 | + env.copy("fatfs/tiny/source/pff.c", "pff.c") |
| 58 | + env.copy("fatfs/tiny/LICENSE.txt", "LICENSE.txt") |
| 59 | + |
| 60 | + env.copy("pffconf.h") |
0 commit comments