Flash usage

Hi I hope you can help me with this.

I'm using a nrf52833. When I build I see Flash usage of 278044 B.

Regions Size 512KB.

My custom board has this in the Flash0 settion of the dts. 

&flash0 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x0 0xc000>;
		};
		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0xc000 0x32000>;
		};
		slot1_partition: partition@3e000 {
			label = "image-1";
			reg = <0x3e000 0x32000>;
		};
		scratch_partition: partition@70000 {
			label = "image-scratch";
			reg = <0x70000 0xa000>;
		};
		storage_partition: partition@7a000 {
			label = "storage";
			reg = <0x7a000 0x6000>;
		};
	};
};

Which looks like this thanks to the VScode stuff.

It appears that my image-0 and image-1 partitions are too small for my rom. 

I guess it works at the moment because overflowing from image-0 to image-1 isn't causing any problems. 

I want to make "storage" as large as possible to collect test user sampling data. 

I dont use DFU, so I think I do not need "image-1" or "image-scratch". Is this correct? Can I also remove "MCUboot"? I plan to use APP_PROTECT in the final version.

How do I build release mode? Is this just by changing the Kconfig settings? Is there a page that I can refer to? (so I get it right)

Thanks for your help!

Parents
  • I changed my dts to look like this and it seems to work fine. I'm not sure if I might have inadvertently broken something


    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		slot0_partition: partition@0 {
    			label = "image-0";
    			reg = <0x0 0x47000>;
    		};
    
    		storage_partition: partition@47000 {
    			label = "storage";
    			reg = <0x47000 0x39000>;
    		};
    	};
    };

    I'm concerned that my ROM is >200K but I'm using experimental features for changing the TX power. 

    CONFIG_BT_LL_SW_SPLIT=y                             #I want to switch this off
    CONFIG_BT_CTLR_ADVANCED_FEATURES=y  

    I believe this is unnecessary in the newer version (I'm still on 2.0.2 because my SPI code breaks because of something deprecated in 2.1.0 onwards.) I can see that LL_SW folder in the memory report is >90KB. 

    I'm working on adding a release_mode.conf with these extra CONFIG options

    CONFIG_RESET_ON_FATAL_ERROR=y
    
    # Disable all debug features
    CONFIG_SHELL=n
    CONFIG_OPENTHREAD_SHELL=n
    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_SERIAL=n
    CONFIG_LOG=n
    CONFIG_LOG_MODE_MINIMAL=n
    CONFIG_ASSERT_VERBOSE=n
    CONFIG_PRINTK=n
    CONFIG_PRINTK_SYNC=n
    CONFIG_THREAD_NAME=n
    

    I'm not sure how to make the compiler code generation release mode though. And I would still like to find a guide that shows me how to build a proper release mode build with all the stuff that I might have overlooked (because it's goign to be needed soon)

    Thanks for your help

    -Jason

  • Hi,

    You can remove mcuboot if you do not need dfu, this will go a long way to solve any flash space issues you are having. Remove CONFIG_BOOTLOADER_MCUBOOT=y or set CONFIG_BOOTLOADER_MCUBOOT=n.

    For configuring build modes, please see https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html#gs-modifying-build-types and let me know if you have any questions regarding the instructions.

    For suggestions to release mode configurations, you may find it useful to compare the non-release and release configurations found in nrf/applications/nrf_desktop.

  • Thanks. I hoped there was a complete guide but this is good. I will figure out the .conf settings. 

    How do I set the compiler to generate release mode code? Minimal size, or maximal speed. I assume its set to "debug" somewhere but I can't see it in Kconfig (which is where I assumed it was)

    Thanks for your help (again!)

  • OMG I just found it. Lol.

    In Build and Link Features->Compiler Options->Optimization level (this was a drop down that I didn't notice somehow)

    I think that's all I needed. THANKS

Reply Children
No Data
Related