MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / launcherPartitionCreateData

Function launcherPartitionCreateData

src/partition_table_model.cpp:630–657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630bool launcherPartitionCreateData(
631 LauncherPartitionTable &table, uint8_t subtype, const char *label, uint32_t size,
632 LauncherPartitionEntry *created, String *error
633) {
634 if (!label || !label[0]) {
635 setError(error, "Data partition label is required");
636 return false;
637 }
638
639 uint32_t partitionSize = alignUp(size, LAUNCHER_FLASH_SECTOR_SIZE);
640 LauncherPartitionRange range;
641 if (!launcherPartitionFindFreeRange(table, partitionSize, LAUNCHER_FLASH_SECTOR_SIZE, range, error)) {
642 return false;
643 }
644
645 LauncherPartitionEntry entry;
646 entry.type = kTypeData;
647 entry.subtype = subtype;
648 entry.offset = range.offset;
649 entry.size = partitionSize;
650 entry.flags = 0;
651 memset(entry.label, 0, sizeof(entry.label));
652 strncpy(entry.label, label, 15);
653
654 if (!launcherPartitionAdd(table, entry, error)) return false;
655 if (created) *created = entry;
656 return true;
657}
658
659String launcherPartitionSanitizedAppLabelBase(const String &name) {
660 String base;

Callers 1

Calls 4

alignUpFunction · 0.85
launcherPartitionAddFunction · 0.85
setErrorFunction · 0.70

Tested by

no test coverage detected