Skip to content

Commit 1e47e21

Browse files
authored
Merge pull request ARMmbed#401 from rgrover/master
for the ARM toolchain, disable/hide calls to printf()s from callback handlers
2 parents 15b80ad + dea4faa commit 1e47e21

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

TESTS/storage_abstraction/basicAPI/basicAPI.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ void programDataCompleteCallback(int32_t status, ARM_STORAGE_OPERATION operation
314314
/* We come here either because of completion for program-data or as a very
315315
* unlikely fall through from synchronous completion of program-data (above). */
316316

317+
#ifndef __CC_ARM
317318
printf("verifying programmed sector at addr %lu\n", (uint32_t)addr);
319+
#endif
318320
verifyBytePattern(addr, sizeofData, BYTE_PATTERN);
319321
++programIteration;
320322

@@ -411,7 +413,9 @@ void programDataOptimalCompleteCallback(int32_t status, ARM_STORAGE_OPERATION op
411413

412414
TEST_ASSERT((operation == ARM_STORAGE_OPERATION_ERASE) || (operation == ARM_STORAGE_OPERATION_PROGRAM_DATA));
413415
if (operation == ARM_STORAGE_OPERATION_ERASE) {
416+
#ifndef __CC_ARM
414417
printf("programming %u bytes at address %lu with pattern 0x%x\n", sizeofData, (uint32_t)addr, BYTE_PATTERN);
418+
#endif
415419
status = drv->ProgramData(addr, buffer, sizeofData);
416420

417421
if (status < ARM_DRIVER_OK) {
@@ -427,7 +431,9 @@ void programDataOptimalCompleteCallback(int32_t status, ARM_STORAGE_OPERATION op
427431
/* We come here either because of completion for program-data or as a very
428432
* unlikely fall through from synchronous completion of program-data (above). */
429433

434+
#ifndef __CC_ARM
430435
printf("verifying programmed sector at addr %lu\n", (uint32_t)addr);
436+
#endif
431437
verifyBytePattern(addr, sizeofData, BYTE_PATTERN);
432438
++programIteration;
433439

@@ -548,7 +554,9 @@ template<size_t ERASE_UNITS_PER_ITERATION>
548554
void eraseCompleteCallback(int32_t status, ARM_STORAGE_OPERATION operation)
549555
{
550556
static unsigned eraseIteration = 0;
557+
#ifndef __CC_ARM
551558
printf("erase<%u> complete callback: iteration %u\n", ERASE_UNITS_PER_ITERATION, eraseIteration);
559+
#endif
552560
TEST_ASSERT_EQUAL(operation, ARM_STORAGE_OPERATION_ERASE);
553561

554562
/* test that the actual sector has been erased */
@@ -560,7 +568,9 @@ void eraseCompleteCallback(int32_t status, ARM_STORAGE_OPERATION operation)
560568
const uint64_t addr = firstBlock.addr + eraseIteration * ERASE_UNITS_PER_ITERATION * firstBlock.attributes.erase_unit;
561569
++eraseIteration;
562570

571+
#ifndef __CC_ARM
563572
printf("testing erased sector at addr %lu\n", (uint32_t)addr);
573+
#endif
564574
verifyBytePattern(addr, ERASE_UNITS_PER_ITERATION * firstBlock.attributes.erase_unit, (uint8_t)0xFF);
565575

566576
Harness::validate_callback();
@@ -617,7 +627,9 @@ control_t test_erase(const size_t call_count)
617627

618628
void eraseChipCompleteCallback(int32_t status, ARM_STORAGE_OPERATION operation)
619629
{
630+
#ifndef __CC_ARM
620631
printf("eraseChip complete callback\n");
632+
#endif
621633
TEST_ASSERT_EQUAL(status, ARM_DRIVER_OK);
622634
TEST_ASSERT_EQUAL(operation, ARM_STORAGE_OPERATION_ERASE_ALL);
623635

@@ -627,7 +639,9 @@ void eraseChipCompleteCallback(int32_t status, ARM_STORAGE_OPERATION operation)
627639
uint64_t addr = firstBlock.addr;
628640

629641
/* test that the flash has been erased */
642+
#ifndef __CC_ARM
630643
printf("testing erased chip\n");
644+
#endif
631645
unsigned index = 0;
632646
static const unsigned MAX_VERIFY_ITERATIONS = 5;
633647
while ((index < MAX_VERIFY_ITERATIONS) && (addr < (firstBlock.addr + firstBlock.size))) {
@@ -780,7 +794,9 @@ void programDataWithMultipleProgramUnitsCallback(int32_t status, ARM_STORAGE_OPE
780794
}
781795
}
782796

797+
#ifndef __CC_ARM
783798
printf("Callback: programming %lu bytes at address %lu with pattern 0x%lx\n", (N_UNITS * info.program_unit), (uint32_t)firstBlock.addr, BYTE_PATTERN);
799+
#endif
784800
rc = drv->ProgramData(firstBlock.addr, buffer, (N_UNITS * info.program_unit));
785801
TEST_ASSERT(rc >= ARM_DRIVER_OK);
786802
if (rc == ARM_DRIVER_OK) {
@@ -794,7 +810,9 @@ void programDataWithMultipleProgramUnitsCallback(int32_t status, ARM_STORAGE_OPE
794810

795811
TEST_ASSERT_EQUAL((N_UNITS * info.program_unit), status);
796812

813+
#ifndef __CC_ARM
797814
printf("Callback: verifying programmed sector at addr %lu\n", (uint32_t)firstBlock.addr);
815+
#endif
798816
if (info.program_unit >= sizeof(BYTE_PATTERN)) {
799817
verifyBytePattern(firstBlock.addr, (N_UNITS * info.program_unit), BYTE_PATTERN);
800818
} else {

0 commit comments

Comments
 (0)