Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

hal: K20 - Flash configuration field issue #212

@0xc0170

Description

@0xc0170

Hi,

I noticed the K20 device does not define any flash configuration. Some tools might ignore flashing the device or overwrite it to protect the chip.

Here's an example of the flash config I created, added to isr.rs for k20

#[link_section=".flash_configuration"]
#[allow(non_upper_case_globals)]
#[no_mangle]
pub static FlashConfigField: [int, ..4] = [
    0xFFFFFFFF,
    0xFFFFFFFF,
    0xFFFFFFFF,
    0xFFFFFFFE,
];

And snippet from the layout.ld file:

SECTIONS
{
    .vector : ALIGN(4)
    {
        FILL(0xff)

        KEEP(*(.isr_vector))
        KEEP(*(.isr_vector_nvic))
    } > vectors

    .flashcfg : ALIGN(4)
    {
        KEEP(*(.flash_configuration))
    } > flash_config

The only way I made it functional was by adding it into k20 isr file (that file is linked separately which does the trick for linker not to remove it, same should be applied to flash protection bits).
, which I don't find as a proper solution. Any suggestions ?

Regards,
0xc0170

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions